如何让我的DataBase First EF 6.1实体变成跟踪代理

编程入门 行业动态 更新时间:2024-10-27 05:24:44
本文介绍了如何让我的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实体变成跟踪代理

本文发布于:2023-11-14 10:39:04,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1586992.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:实体   DataBase   EF

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!