简体   繁体   中英

Cant Disable Lazy Loading and Proxy Creation on DbContext EFCore

Is there a way to disable lazy Loading on EntityFramework.Core

In my previous code I have done the following :

  public DataContext(string nameOrConnectionString) : base(nameOrConnectionString)
    {

        Configuration.LazyLoadingEnabled = false;
        Configuration.ProxyCreationEnabled = false;
    }

but now using the new ef 7 i cant find any option to do so

public DataContext(DbContextOptions<DataContext> options) : base(options)
    {
        //should have been in the options
    }

截至 2019 年,支持延迟加载但默认情况下未启用,因此您仍然无需执行任何操作。

Per the current documentation on 'Loading Related Data':

Lazy loading is not yet supported by EF Core. You can view the lazy loading item on our backlog to track this feature.

So, your answer: do nothing.

如果您的问题被禁用 LazyLoading 尝试: this.ChangeTracker.LazyLoadingEnabled = false;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM