add dbcontext lifetime option
This commit is contained in:
parent
b89e500c21
commit
68ee7c755c
1 changed files with 2 additions and 2 deletions
|
|
@ -75,10 +75,10 @@ BsonSerializer.RegisterSerializer(new DateTimeSerializer(BsonType.String));
|
|||
// Register DbContext
|
||||
var defaultConnection = builder.Configuration.GetConnectionString("DefaultConnection");
|
||||
builder.Services.AddDbContext<ApplicationDbContext>(options =>
|
||||
options.UseMySql(defaultConnection, ServerVersion.AutoDetect(defaultConnection)));
|
||||
options.UseMySql(defaultConnection, ServerVersion.AutoDetect(defaultConnection)), ServiceLifetime.Transient);
|
||||
var metadataConnection = builder.Configuration.GetConnectionString("MetadataConnection");
|
||||
builder.Services.AddDbContext<MetadataDbContext>(options =>
|
||||
options.UseMySql(metadataConnection, ServerVersion.AutoDetect(metadataConnection)));
|
||||
options.UseMySql(metadataConnection, ServerVersion.AutoDetect(metadataConnection)), ServiceLifetime.Transient);
|
||||
|
||||
// Add config CORS
|
||||
builder.Services.AddCors(options => options.AddDefaultPolicy(builder =>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue