Timothy Schenk
46649adfd8
All checks were successful
Build, Package and Push Images / preprocess (push) Successful in 2s
Build, Package and Push Images / build (push) Successful in 23s
Build, Package and Push Images / sonarqube (push) Has been skipped
Build, Package and Push Images / sbom-scan (push) Successful in 32s
Build, Package and Push Images / container-build (push) Successful in 3m16s
Build, Package and Push Images / container-sbom-scan (push) Successful in 32s
requires base stats and parsing of values provided by user
27 lines
1 KiB
C#
27 lines
1 KiB
C#
namespace Server.DB;
|
|
|
|
using Documents;
|
|
using Microsoft.EntityFrameworkCore;
|
|
using Microsoft.Extensions.Configuration;
|
|
using Microsoft.Extensions.Logging;
|
|
|
|
public class WonderkingContext : DbContext
|
|
{
|
|
private readonly IConfiguration _configuration;
|
|
private readonly ILoggerFactory _loggerFactory;
|
|
|
|
public WonderkingContext(ILoggerFactory loggerFactory, IConfiguration configuration)
|
|
{
|
|
this._loggerFactory = loggerFactory;
|
|
this._configuration = configuration;
|
|
}
|
|
|
|
public DbSet<Account> Accounts { get; set; }
|
|
public DbSet<Character> Characters { get; set; }
|
|
|
|
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) =>
|
|
optionsBuilder
|
|
.UseNpgsql(
|
|
$"Host={this._configuration["DB:Host"]};Username={this._configuration["DB:Username"]};Password={this._configuration["DB:Password"]};Database={this._configuration["DB:Database"]};Port={this._configuration["DB:Port"]}")
|
|
.EnableSensitiveDataLogging().UseLoggerFactory(this._loggerFactory);
|
|
}
|