在新配置下切换 EF7 中的 ProxyCreation

Toggling ProxyCreation in EF7 under new configuration

所以在 EF6 中,可以像这样禁用代理创建:

this.Configuration.ProxyCreationEnabled = false;

据我所知,EF7 下的配置方案已更改,但我找不到有关如何更改的任何信息。我检查了 https://docs.efproject.net/en/latest/miscellaneous/configuring-dbcontext.html 甚至分析了 DbContextOptionsBuilder 对象,但在其中找不到任何内容。

我是不是走错路了,还是我遗漏了什么?提前致谢。

EF7 EF Core 1.0 不创建代理,因此没有相应的配置选项。参见 https://github.com/aspnet/EntityFramework/issues/997

Entity Framework Core 2.1开始支持Lazy load。请参阅:https://docs.microsoft.com/en-us/ef/core/querying/related-data#lazy-loading

这是来自 Whosebug 的最新问题: