Install the Proxies package using nuget manager
Install-Package Microsoft.EntityFrameworkCore.Proxies
Enable LazyLoadingProxies You can enable it with a call to UseLazyLoadingProxies:
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
=> optionsBuilder
.UseLazyLoadingProxies()
.UseSqlServer(myConnectionString);
Or when using AddDbContext:
Go inside the Startup.cs file inside the ConfigureServices method
services.AddDbContext<BloggingContext>(
b => b.UseLazyLoadingProxies()
.UseSqlServer(myConnectionString));
if you have used the DbContextPool than
services.AddDbContextPool<AdhyatmavaniContext>(
b => b
.UseLazyLoadingProxies()
.UseSqlServer(myConnectionString));