How do I get my DataBase First EF 6.1 Entities to become a change tracking proxies

懵懂的女人 提交于 2019-12-25 06:48:39

问题


I'm struggling to get my model's entities to be change tracker proxies rather than utilize snap shot change detection.

My entities are created by the EF designer and have been otherwise unmodified. I followed the steps in Programming Entity Framework: DbContext but my entities never seem to inherit the IEntitiyWithChangeTracker (though they are in fact DynamicProxies).

Can anyone enumerate the steps to make an entity created by the DataBase First EF 6.1 designer into a change tracker proxy? I assume that modification of the classes must be made outside the designer, nothing will be automatic.


回答1:


So, the answer lies in using the correct Namespace for IEntityWithChangeTracker. In EF6.x if you test with System.Data.Entity.Core.Objects.DataClasses.IEntityWithChangeTracker your entity will return true. Thanks Fred Bao of MSFT



来源:https://stackoverflow.com/questions/26930324/how-do-i-get-my-database-first-ef-6-1-entities-to-become-a-change-tracking-proxi

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!