Context submitchanges not updating


Instead of being able to fully take advantage of X, Y, Z those portions that do the updating will have to go through hoops like the example above to be able to update something. I absolutely love LINQ [with the exception of this! I had to re-write a substantial part of the application I am working on after some major database changes for features requested by the client..

If you retrieve an object from some external source you're downright out of luck.

Using the connected state is also bad news for New entries which have to be explicitly added with Table. This means the burden of determining whether you're dealing with new entity or updating an existing one is really up to you, which is also sucky - LINQ to SQL doesn't figure that out automatically.

Attach(customer); But it also doesn't do anything on the server. The Context/Tables hold all of the information necessary to figure out what's changed and it would be a fairly trivial matter - using Reflection or simply using a full field SQL Update statement to get updates to go to the server.

It basically looks at the object and sees no changes related to the current context so it doesn't update anything. And yes there is a potential workaround for this particular issue for some scenarios which involves just letting the business object hang on to the Data Context, which frankly is the more common case.

So rather than doing an update as above you'd write say a Save() method that does: That works *as long as you hang on to the business object*.