Created
August 30, 2021 15:35
-
-
Save mirmostafa/5bd23b63b0fc35e2310994c14283ded2 to your computer and use it in GitHub Desktop.
DbContext Pool Service
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
public void ConfigureServices(IServiceCollection services) | |
{ | |
//.... | |
services.AddDbContextPool<S2ReadDbContext>(options => | |
{ | |
options.UseQueryTrackingBehavior(QueryTrackingBehavior.NoTracking); | |
options.UseSqlServer(Configuration.GetConnectionString("S2ReadConnection")); | |
options.EnableSensitiveDataLogging(); | |
}); | |
services.AddDbContextPool<S2WriteDbContext>(options => | |
{ | |
options.UseQueryTrackingBehavior(QueryTrackingBehavior.TrackAll); | |
options.UseSqlServer(Configuration.GetConnectionString("S2WriteConnection")); | |
options.EnableSensitiveDataLogging(); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment