using FinlyticCore.Database; using FinlyticCore.Entities.Settings; using Microsoft.EntityFrameworkCore; namespace FinlyticNotify.Database; /// /// Entity Framework DbContext used by FinlyticNotify exclusively for its own database (finlytic_notify) /// and dynamic settings. /// public class NotifyDbContext : DbContext, ISettingsDbContext { /// /// Initializes a new instance of the class. /// public NotifyDbContext(DbContextOptions options) : base(options) { } /// Dynamic settings table for FinlyticNotify. public DbSet DynamicSettings => Set(); /// protected override void OnModelCreating(ModelBuilder modelBuilder) { base.OnModelCreating(modelBuilder); modelBuilder.Entity(entity => { entity.HasKey(e => e.Id); entity.HasIndex(e => e.Key).IsUnique(); }); } }