Added main entities
This commit is contained in:
5 files changed
+72
-2
No files matched your search
@@ -6,6 +6,12 @@ public sealed class DataContext : DbContext
|
||||
{
|
||||
public DbSet<Setting>? Settings { get; set; }
|
||||
|
||||
public DbSet<Section>? Sections { get; set; }
|
||||
|
||||
public DbSet<TextElement>? TextElements { get; set; }
|
||||
|
||||
public DbSet<Translation>? Translations { get; set; }
|
||||
|
||||
public DataContext(DbContextOptions<DataContext> contextOptions) : base(contextOptions)
|
||||
{
|
||||
}
|
||||
@@ -14,7 +20,7 @@ public sealed class DataContext : DbContext
|
||||
{
|
||||
base.OnModelCreating(modelBuilder);
|
||||
|
||||
#region Ideas
|
||||
#region Settings
|
||||
|
||||
modelBuilder.Entity<Setting>().HasIndex(n => n.Id);
|
||||
modelBuilder.Entity<Setting>().HasIndex(n => n.Name).IsUnique();
|
||||
@@ -24,5 +30,27 @@ public sealed class DataContext : DbContext
|
||||
modelBuilder.Entity<Setting>().HasIndex(n => n.TextValue);
|
||||
|
||||
#endregion
|
||||
|
||||
#region Sections
|
||||
|
||||
modelBuilder.Entity<Section>().HasIndex(n => n.Id);
|
||||
modelBuilder.Entity<Section>().HasIndex(n => n.Name);
|
||||
|
||||
#endregion
|
||||
|
||||
#region TextElements
|
||||
|
||||
modelBuilder.Entity<TextElement>().HasIndex(n => n.Id);
|
||||
modelBuilder.Entity<TextElement>().HasIndex(n => n.Code);
|
||||
|
||||
#endregion
|
||||
|
||||
#region Translations
|
||||
|
||||
modelBuilder.Entity<Translation>().HasIndex(n => n.Id);
|
||||
modelBuilder.Entity<Translation>().HasIndex(n => n.Culture);
|
||||
modelBuilder.Entity<Translation>().HasIndex(n => n.Text);
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user