Created
May 21, 2019 21:10
-
-
Save maltegoetz/dea243b3fca01c841326692977fb85d5 to your computer and use it in GitHub Desktop.
EF Core Enable Lazy Loading
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//You can either override OnConfiguring in DbContext: | |
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) | |
=> optionsBuilder | |
.UseLazyLoadingProxies() | |
.UseSqlServer(myConnectionString); | |
//...or if you are using ASP.NET and AddDbContext: | |
.AddDbContext<PizzaContext>( | |
b => b.UseLazyLoadingProxies() | |
.UseSqlServer(myConnectionString)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment