I have tried to disable Lazy loading those two ways:
1)
public SqlDbContext(DbContextOptions<SqlDbContext> options) : base(options)
{
this.ChangeTracker.LazyLoadingEnabled = false;
}
2)
public void ConfigureServices(IServiceCollection services)
{
services.AddDbContext<SqlDbContext>(options => {
options.UseSqlServer(Configuration.GetConnectionString("SqlDbContext"));
options.UseLazyLoadingProxies(false);
});
And I don't use the key word "virtual" in the navigation.
Unfortunately the lazy loading is stil working. I want to disable it, to force me using only eager loading, so throw an error when I forget to use Include().
But with thouse two approaches the query is still returning the results.