Context submitchanges not updating
So rather than using LINQ directly in the front end UI I want an abstraction layer.One problem that I can't seem to resolve with the data context is how to update Entities based on POCO objects that didn't originate out of the Data Context.
The idea is that you have wrapper methods for CRUD (and all other data access) in the business layer so you'd write code like this: True this doesn't look much different than using the LINQ objects directly but the big difference is that you get some level of abstraction for the load and update code so you can inject things like tracing and error handling etc.a member that is not set or checked for optimistic concurrency is ignored. So, I make an update to an object, let's say from that example in word document:c2. @Ryan - Change tracking works through INotify Changed I believe. However, the point is moot if it's complaining about the PK being duplicated in all scenerarios.I think you guys are misunderstanding how Attach is used.Hopefully I'm just being dense and there are some workarounds for some of these issues, but reading a number of other posts on this 'detached' issue at least it doesn't appear so... One of my upcoming blog posts will cover this in more detail and cover scenarios were you take changes and apply them from a different tier. This, as well as the nature of anonymous types (in my book, anonymous typing is what truly makes Linq a killer feature) and the intrinsic inability to persist them across tiers also detracts from the attractiveness of Linq to Sql for the middle tier.Thanks, Scott If a timestamp or a version number column is used for optimistic concurrency check, then the corresponding member must be set before calling Attach(). Yeah the anonymous type issue is also pretty depressing: Log/posts/33570But that's maybe not as critical as you can often get away with either passing types back as explicit types, creating custom types or in binding scenarios you don't even need the type information.