More updates.
This commit is contained in:
@@ -37,7 +37,7 @@ public class MangaContext(DbContextOptions options) : DbContext(options)
|
||||
//ConfigureMangaChapter(modelBuilder);
|
||||
//ConfigureChapterSource(modelBuilder);
|
||||
//ConfigureChapterPage(modelBuilder);
|
||||
ConfigureSourceChapter(modelBuilder);
|
||||
ConfigureMangaSourceChapter(modelBuilder);
|
||||
ConfigureSourcePage(modelBuilder);
|
||||
}
|
||||
|
||||
@@ -114,29 +114,29 @@ public class MangaContext(DbContextOptions options) : DbContext(options)
|
||||
{
|
||||
modelBuilder
|
||||
.Entity<MangaDescription>()
|
||||
.HasKey(mangaTitle => mangaTitle.MangaTitleId);
|
||||
.HasKey(mangaDescription => mangaDescription.MangaDescriptionId);
|
||||
|
||||
modelBuilder.Entity<MangaDescription>()
|
||||
.Property(mt => mt.Name)
|
||||
.Property(mangaDescription => mangaDescription.Name)
|
||||
.IsRequired();
|
||||
|
||||
modelBuilder.Entity<MangaDescription>()
|
||||
.Property(mt => mt.Language)
|
||||
.Property(mangaDescription => mangaDescription.Language)
|
||||
.IsRequired();
|
||||
|
||||
modelBuilder.Entity<MangaDescription>()
|
||||
.HasIndex(mangaTitle => new { mangaTitle.MangaId, mangaTitle.Name, mangaTitle.Language })
|
||||
.HasIndex(mangaDescription => new { mangaDescription.MangaSourceId, mangaDescription.Name, mangaDescription.Language })
|
||||
.IsUnique();
|
||||
|
||||
modelBuilder
|
||||
.Entity<MangaDescription>()
|
||||
.HasIndex(mangaTitle => mangaTitle.Name);
|
||||
.HasIndex(mangaDescription => mangaDescription.Name);
|
||||
|
||||
modelBuilder
|
||||
.Entity<MangaDescription>()
|
||||
.HasOne(x => x.Manga)
|
||||
.HasOne(x => x.MangaSource)
|
||||
.WithMany(x => x.Descriptions)
|
||||
.HasForeignKey(x => x.MangaId)
|
||||
.HasForeignKey(x => x.MangaSourceId)
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
}
|
||||
|
||||
@@ -273,7 +273,7 @@ public class MangaContext(DbContextOptions options) : DbContext(options)
|
||||
// .OnDelete(DeleteBehavior.Cascade);
|
||||
//}
|
||||
|
||||
private static void ConfigureSourceChapter(ModelBuilder modelBuilder)
|
||||
private static void ConfigureMangaSourceChapter(ModelBuilder modelBuilder)
|
||||
{
|
||||
modelBuilder
|
||||
.Entity<SourceChapter>()
|
||||
|
||||
Reference in New Issue
Block a user