Enabled EF Core lazy loading.

This commit is contained in:
Harrison Deng 2021-07-14 01:35:58 -05:00
parent 840b59fcba
commit 56544938ac
2 changed files with 5 additions and 2 deletions

View File

@ -18,6 +18,7 @@
<PackageReference Include="Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore" Version="5.0.5" />
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="5.0.5" />
<PackageReference Include="Microsoft.AspNetCore.Identity.UI" Version="5.0.5" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Proxies" Version="5.0.8" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="5.0.5" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="5.0.5" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="5.0.5" />

View File

@ -25,8 +25,10 @@ namespace Props
public void ConfigureServices(IServiceCollection services)
{
services.AddDbContext<ApplicationDbContext>(options =>
options.UseSqlite(
Configuration.GetConnectionString("DefaultConnection")));
{
options.UseLazyLoadingProxies();
options.UseSqlite(Configuration.GetConnectionString("DefaultConnection"));
});
services.AddDatabaseDeveloperPageExceptionFilter();