mirror of
https://github.com/tgstation/tgstation-server.git
synced 2026-08-30 08:33:19 +01:00
Condense two lamdas
This commit is contained in:
@@ -154,15 +154,13 @@ namespace Tgstation.Server.Host.Core
|
||||
|
||||
var databaseConfiguration = databaseConfigurationSection.Get<DatabaseConfiguration>();
|
||||
|
||||
void ConfigureDatabase(DbContextOptionsBuilder builder)
|
||||
{
|
||||
if (hostingEnvironment.IsDevelopment())
|
||||
builder.EnableSensitiveDataLogging();
|
||||
};
|
||||
|
||||
void AddTypedContext<TContext>() where TContext : DatabaseContext<TContext>
|
||||
{
|
||||
services.AddDbContext<TContext>(ConfigureDatabase);
|
||||
services.AddDbContext<TContext>(builder =>
|
||||
{
|
||||
if (hostingEnvironment.IsDevelopment())
|
||||
builder.EnableSensitiveDataLogging();
|
||||
});
|
||||
services.AddScoped<IDatabaseContext>(x => x.GetRequiredService<TContext>());
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user