using Microsoft.EntityFrameworkCore; using DD.Persistence.Database.Entity; using DD.Persistence.Database.Model; namespace DD.Persistence.Database; /// /// EF контекст для любых БД поддерживаемых в EF /// public class PersistenceDbContext : DbContext { public DbSet Setpoint => Set(); public DbSet ValuesIdentities => Set(); public DbSet TimestampedValues => Set(); public DbSet ChangeLog => Set(); public DbSet TechMessage => Set(); public DbSet ParameterData => Set(); public DbSet DataSourceSystem => Set(); public PersistenceDbContext(DbContextOptions options) : base(options) { } protected override void OnModelCreating(ModelBuilder modelBuilder) { modelBuilder.Entity() .Property(e => e.Identity) .HasJsonConversion(); modelBuilder.Entity() .Property(e => e.Values) .HasJsonConversion(); modelBuilder.Entity() .Property(e => e.Value) .HasJsonConversion(); } }