|
|
@ -33,7 +33,13 @@ namespace Microsoft.eShopOnContainers.Services.Identity.API |
|
|
|
{ |
|
|
|
// Add framework services.
|
|
|
|
services.AddDbContext<ApplicationDbContext>(options => |
|
|
|
options.UseSqlServer(Configuration["ConnectionString"])); |
|
|
|
options.UseSqlServer(Configuration["ConnectionString"], |
|
|
|
sqlServerOptionsAction: sqlOptions => |
|
|
|
{ |
|
|
|
sqlOptions.MigrationsAssembly(typeof(Startup).GetTypeInfo().Assembly.GetName().Name); |
|
|
|
//Configuring Connection Resiliency: https://docs.microsoft.com/en-us/ef/core/miscellaneous/connection-resiliency
|
|
|
|
sqlOptions.EnableRetryOnFailure(maxRetryCount: 10, maxRetryDelay: TimeSpan.FromSeconds(30), errorNumbersToAdd: null); |
|
|
|
})); |
|
|
|
|
|
|
|
services.AddIdentity<ApplicationUser, IdentityRole>() |
|
|
|
.AddEntityFrameworkStores<ApplicationDbContext>() |
|
|
@ -77,13 +83,23 @@ namespace Microsoft.eShopOnContainers.Services.Identity.API |
|
|
|
.AddAspNetIdentity<ApplicationUser>() |
|
|
|
.AddConfigurationStore(options => |
|
|
|
{ |
|
|
|
options.ConfigureDbContext = builder => builder.UseSqlServer(connectionString, opts => |
|
|
|
opts.MigrationsAssembly(migrationsAssembly)); |
|
|
|
options.ConfigureDbContext = builder => builder.UseSqlServer(connectionString, |
|
|
|
sqlServerOptionsAction: sqlOptions => |
|
|
|
{ |
|
|
|
sqlOptions.MigrationsAssembly(migrationsAssembly); |
|
|
|
//Configuring Connection Resiliency: https://docs.microsoft.com/en-us/ef/core/miscellaneous/connection-resiliency
|
|
|
|
sqlOptions.EnableRetryOnFailure(maxRetryCount: 10, maxRetryDelay: TimeSpan.FromSeconds(30), errorNumbersToAdd: null); |
|
|
|
}); |
|
|
|
}) |
|
|
|
.AddOperationalStore(options => |
|
|
|
{ |
|
|
|
options.ConfigureDbContext = builder => builder.UseSqlServer(connectionString, opts => |
|
|
|
opts.MigrationsAssembly(migrationsAssembly)); |
|
|
|
options.ConfigureDbContext = builder => builder.UseSqlServer(connectionString, |
|
|
|
sqlServerOptionsAction: sqlOptions => |
|
|
|
{ |
|
|
|
sqlOptions.MigrationsAssembly(migrationsAssembly); |
|
|
|
//Configuring Connection Resiliency: https://docs.microsoft.com/en-us/ef/core/miscellaneous/connection-resiliency
|
|
|
|
sqlOptions.EnableRetryOnFailure(maxRetryCount: 10, maxRetryDelay: TimeSpan.FromSeconds(30), errorNumbersToAdd: null); |
|
|
|
}); |
|
|
|
}) |
|
|
|
.Services.AddTransient<IProfileService, ProfileService>(); |
|
|
|
|
|
|
|