Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save MahdiKarimipour/c4f1dc352f9a5b7b27564906537c9787 to your computer and use it in GitHub Desktop.

Select an option

Save MahdiKarimipour/c4f1dc352f9a5b7b27564906537c9787 to your computer and use it in GitHub Desktop.
Enable Caching of Internal Service Providers in Production
services.AddDbContextPool<IdentityDBContext>(options =>
{
options.UseSqlServer(secrets.DbConnectionString,
x => x.MigrationsAssembly("DataAccess")
.EnableRetryOnFailure(maxRetryCount: 3))
.UseLazyLoadingProxies()
.EnableSensitiveDataLogging(CurrentEnvironment.IsDevelopment())
.EnableServiceProviderCaching()
.UseLoggerFactory(IdentityDBContext.PropertyAppLoggerFactory);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment