EF 4.0 model caching the data, and does not detect the modified data

后端 未结 2 445
慢半拍i
慢半拍i 2020-12-10 17:54

I am developing ASP.NET application and I have problem with the EF 4.0 model.

The EF model detects the newly added and deleted data, but not the modified data from t

相关标签:
2条回答
  • 2020-12-10 18:09

    This is correct behavior based on essential concepts of ORM. It also works same for Linq to SQL. The reason for this is design pattern called IdentityMap which ensures that each entity identified by its key is created only once for object context. So your first query creates entites but your subsequent queries don't recreate them - they already exists. The full description of this problem is described in this very nice article.

    0 讨论(0)
  • 2020-12-10 18:19

    You can avoid this by using a new object of the entity model in your code in every method. Or you can read more information in the following answer to the same question in the MSDN, Click Here

    0 讨论(0)
提交回复
热议问题