more soft

This commit is contained in:
2019-11-14 14:06:28 +00:00
parent 7aafda0f71
commit 3676e6e93d

View File

@ -77,17 +77,31 @@ namespace Yavsc.Models
et.FindProperty("DateCreated").IsReadOnlyAfterSave = true; et.FindProperty("DateCreated").IsReadOnlyAfterSave = true;
} }
} }
// this is not a failback procedure.
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{ {
var appSetup = (string)AppDomain.CurrentDomain.GetData(Constants.YavscConnectionStringEnvName); if (optionsBuilder.IsConfigured) return;
if (appSetup!=null) optionsBuilder.UseNpgsql(appSetup); if (!string.IsNullOrWhiteSpace(Startup.ConnectionString))
else { {
var envSetup = Environment.GetEnvironmentVariable(Constants.YavscConnectionStringEnvName); optionsBuilder.UseNpgsql(Startup.ConnectionString);
if (envSetup!=null) optionsBuilder.UseNpgsql(envSetup); return;
} }
var appSetup = (string) AppDomain.CurrentDomain.GetData(Constants.YavscConnectionStringEnvName);
if (!string.IsNullOrWhiteSpace(appSetup))
{
optionsBuilder.UseNpgsql(appSetup);
return;
}
var envSetup = Environment.GetEnvironmentVariable(Constants.YavscConnectionStringEnvName);
if (envSetup!=null)
optionsBuilder.UseNpgsql(envSetup);
} }
public DbSet<Client> Applications { get; set; } public DbSet<Client> Applications { get; set; }
public DbSet<RefreshToken> RefreshTokens { get; set; } public DbSet<RefreshToken> RefreshTokens { get; set; }