Bug #59996 | old entity is returned, not real data from DB | ||
---|---|---|---|
Submitted: | 7 Feb 2011 20:17 | Modified: | 2 Mar 2011 17:45 |
Reporter: | saverio mosca | Email Updates: | |
Status: | Not a Bug | Impact on me: | |
Category: | Connector / NET | Severity: | S1 (Critical) |
Version: | 6.3.5 | OS: | Windows (7 home premium/fx4.0) |
Assigned to: | CPU Architecture: | Any | |
Tags: | entity framework, linq to entities |
[7 Feb 2011 20:17]
saverio mosca
[15 Feb 2011 16:13]
Richard Deeming
This is a feature of the Entity Framework known as identity resolution. You can change the MergeOption property for the query to override this behaviour. "The default is MergeOption.AppendOnly ... new entities retrieved by the query are attached to the ObjectContext, and if an entity which has the same key as an incoming entity is already attached to the context, then that object is returned as is rather than the incoming entity." http://blogs.msdn.com/b/dsimmons/archive/2010/01/12/ef-merge-options-and-compiled-queries....
[18 Feb 2011 14:56]
saverio mosca
Thanks Richard, I really didn't know such property..never heard. But the article on your link is well explained. Thanks for your time, Sav