如何让我的DataBase First EF 6.1实体变成跟踪代理 [英] How do I get my DataBase First EF 6.1 Entities to become a change tracking proxies

查看:251
本文介绍了如何让我的DataBase First EF 6.1实体变成跟踪代理的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我的实体是由EF设计师创建的,具有没有修改。我遵循编程实体框架中的步骤:DbContext,但我的实体似乎没有继承IEntitiyWithChangeTracker(尽管它们实际上是DynamicProxies)。



任何人都可以列举步骤由DataBase First EF 6.1设计人员创建的实体变为跟踪代理?我认为修改类必须在设计师之外进行,否则就不会自动。

解决方案

所以答案在于对IEntityWithChangeTracker使用正确的命名空间。在EF6.x中,如果使用System.Data.Entity.Core.Objects.DataClasses.IEntityWithChangeTracker测试,您的实体将返回true。感谢MSFT的Fred Bao


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.

解决方案

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

这篇关于如何让我的DataBase First EF 6.1实体变成跟踪代理的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆