我知道我们可以通过这种方式以编程方式禁用ProxyCreationEnabled:
using (var newContext = new MyDbContext())
{
newContext.Configuration.ProxyCreationEnabled = false;
}
但我想知道有没有办法在Fluent API中禁用Entity Proxies?
答案 0 :(得分:0)
FluentAPI
与映射配置有关,而代理创建则与上下文配置有关。
您可以尝试:
只需将this.Configuration.ProxyCreationEnabled = false;
添加到构造函数中。
使用sealed class
'
请参阅MSDN