Added drift supression to Program.cs
This commit is contained in:
@@ -24,6 +24,11 @@ namespace LiteCharmsSecurity.Admin.Api
|
|||||||
|
|
||||||
public static async Task Main(string[] args)
|
public static async Task Main(string[] args)
|
||||||
{
|
{
|
||||||
|
// Force EF Core to globally ignore the Model Drift warning at the AppDomain level
|
||||||
|
AppContext.SetSwitch("Microsoft.EntityFrameworkCore.Issue34300", true);
|
||||||
|
// OR if using standard diagnostics suppression:
|
||||||
|
System.Environment.SetEnvironmentVariable("EF_CORE_SUPPRESS_PENDING_MODEL_CHANGES_WARNING", "true");
|
||||||
|
|
||||||
var configuration = GetConfiguration(args);
|
var configuration = GetConfiguration(args);
|
||||||
|
|
||||||
Log.Logger = new LoggerConfiguration()
|
Log.Logger = new LoggerConfiguration()
|
||||||
|
|||||||
@@ -111,13 +111,6 @@ namespace LiteCharmsSecurity.Admin.Api
|
|||||||
DatabaseMigrationsConfiguration databaseMigration)
|
DatabaseMigrationsConfiguration databaseMigration)
|
||||||
{
|
{
|
||||||
services.AddDbContexts<AdminIdentityDbContext, IdentityServerConfigurationDbContext, IdentityServerPersistedGrantDbContext, AdminLogDbContext, AdminAuditLogDbContext, IdentityServerDataProtectionDbContext, AdminConfigurationDbContext, AuditLog>(Configuration, databaseMigration);
|
services.AddDbContexts<AdminIdentityDbContext, IdentityServerConfigurationDbContext, IdentityServerPersistedGrantDbContext, AdminLogDbContext, AdminAuditLogDbContext, IdentityServerDataProtectionDbContext, AdminConfigurationDbContext, AuditLog>(Configuration, databaseMigration);
|
||||||
|
|
||||||
// 2. Intercept the DbContextOptions configurations in the DI container and inject the ignore rule
|
|
||||||
services.Configure<DbContextOptionsBuilder<AdminIdentityDbContext>>(options =>
|
|
||||||
options.ConfigureWarnings(w => w.Ignore(RelationalEventId.PendingModelChangesWarning)));
|
|
||||||
|
|
||||||
services.Configure<DbContextOptionsBuilder<IdentityServerConfigurationDbContext>>(options =>
|
|
||||||
options.ConfigureWarnings(w => w.Ignore(RelationalEventId.PendingModelChangesWarning)));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual void RegisterAuthentication(IServiceCollection services)
|
public virtual void RegisterAuthentication(IServiceCollection services)
|
||||||
|
|||||||
Reference in New Issue
Block a user