using Microsoft.EntityFrameworkCore; using Npgsql; using CH.Dal.DbEntity; using CH.Enum; namespace CH.Dal; public class CHDbContext(DbContextOptions options) : CHDbScaffoldedContext(options) { static CHDbContext() => NpgsqlConnection.GlobalTypeMapper .MapEnum("currency") .MapEnum("energy_rate_exception_threshold_reset_type"); protected override void OnModelCreating(ModelBuilder modelBuilder) { base.OnModelCreating(modelBuilder); modelBuilder.HasPostgresEnum("currency"); modelBuilder.HasPostgresEnum("energy_rate_exception_threshold_reset_type"); modelBuilder.Entity(entity => { entity.Property(e => e.Currency) .HasColumnName("currency") .HasColumnType("currency"); }); modelBuilder.Entity(entity => { entity.Property(e => e.ResetType) .HasColumnName("reset_type") .HasColumnType("energy_rate_exception_threshold_reset_type"); }); } protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) { return; } }