Toggling ProxyCreation in EF7 under new configuration

与世无争的帅哥 提交于 2019-12-10 13:27:38

问题


So in EF6, one could disable proxy creation like so:

this.Configuration.ProxyCreationEnabled = false;

From what I could find, the configuration scheme under EF7 has changed, but I cannot find anything on how to do so. I went through https://docs.efproject.net/en/latest/miscellaneous/configuring-dbcontext.html and even analyzed the DbContextOptionsBuilder object, but cannot find anything on it.

Am I going about ti the wrong way or is there something im missing? Thanks in advance.


回答1:


EF7 EF Core 1.0 does not do proxy creation, so accordingly, there is no configuration option for this. See https://github.com/aspnet/EntityFramework/issues/997




回答2:


Entity Framework Core 2.1 starts to support Lazy load. Please see: https://docs.microsoft.com/en-us/ef/core/querying/related-data#lazy-loading

Here is recent question with answers from stackoverflow: What is the equivalent of .Configuration.ProxyCreationEnabled in EF Core?



来源:https://stackoverflow.com/questions/36222699/toggling-proxycreation-in-ef7-under-new-configuration

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