using Microsoft.EntityFrameworkCore; namespace DataModel.Database.Common; public sealed class DataContext : DbContext { public DbSet? Settings { get; set; } public DbSet
? Sections { get; set; } public DbSet? TextElements { get; set; } public DbSet? Translations { get; set; } public DataContext(DbContextOptions contextOptions) : base(contextOptions) { } protected override void OnModelCreating(ModelBuilder modelBuilder) { base.OnModelCreating(modelBuilder); #region Settings modelBuilder.Entity().HasIndex(n => n.Id); modelBuilder.Entity().HasIndex(n => n.Name).IsUnique(); modelBuilder.Entity().HasIndex(n => n.BoolValue); modelBuilder.Entity().HasIndex(n => n.GuidValue); modelBuilder.Entity().HasIndex(n => n.IntegerValue); modelBuilder.Entity().HasIndex(n => n.TextValue); #endregion #region Sections modelBuilder.Entity
().HasIndex(n => n.Id); modelBuilder.Entity
().HasIndex(n => n.Name); modelBuilder.Entity
().HasIndex(n => n.Depth); modelBuilder.Entity
().HasIndex(n => n.DataKey); #endregion #region TextElements modelBuilder.Entity().HasIndex(n => n.Id); modelBuilder.Entity().HasIndex(n => n.Code); #endregion #region Translations modelBuilder.Entity().HasIndex(n => n.Id); modelBuilder.Entity().HasIndex(n => n.Culture); modelBuilder.Entity().HasIndex(n => n.Text); #endregion } }