Do not autoinclude chapters for Manga

This commit is contained in:
Glax 2025-05-16 15:15:11 +02:00
parent a5954ed5c8
commit 4247ae7740
3 changed files with 3 additions and 1 deletions

View File

@ -136,7 +136,7 @@ public class PgsqlContext(DbContextOptions<PgsqlContext> options) : DbContext(op
.AutoInclude(); .AutoInclude();
modelBuilder.Entity<Manga>() modelBuilder.Entity<Manga>()
.Navigation(m => m.Chapters) .Navigation(m => m.Chapters)
.AutoInclude(); .AutoInclude(false);
//Manga owns MangaAltTitles //Manga owns MangaAltTitles
modelBuilder.Entity<Manga>() modelBuilder.Entity<Manga>()
.OwnsMany<MangaAltTitle>(m => m.AltTitles) .OwnsMany<MangaAltTitle>(m => m.AltTitles)

View File

@ -34,6 +34,7 @@ public class MoveMangaLibraryJob : Job
protected override IEnumerable<Job> RunInternal(PgsqlContext context) protected override IEnumerable<Job> RunInternal(PgsqlContext context)
{ {
context.Attach(Manga); context.Attach(Manga);
context.Entry(Manga).Collection<Chapter>(m => m.Chapters).Load();
Dictionary<Chapter, string> oldPath = Manga.Chapters.ToDictionary(c => c, c => c.FullArchiveFilePath); Dictionary<Chapter, string> oldPath = Manga.Chapters.ToDictionary(c => c, c => c.FullArchiveFilePath);
Manga.Library = ToLibrary; Manga.Library = ToLibrary;
try try

View File

@ -29,6 +29,7 @@ public class UpdateFilesDownloadedJob : Job
protected override IEnumerable<Job> RunInternal(PgsqlContext context) protected override IEnumerable<Job> RunInternal(PgsqlContext context)
{ {
context.Attach(Manga); context.Attach(Manga);
context.Entry(Manga).Collection<Chapter>(m => m.Chapters).Load();
foreach (Chapter chapter in Manga.Chapters) foreach (Chapter chapter in Manga.Chapters)
chapter.Downloaded = chapter.CheckDownloaded(); chapter.Downloaded = chapter.CheckDownloaded();