mirror of
https://github.com/C9Glax/tranga.git
synced 2025-09-10 11:58:19 +02:00
Context Load Navigations and Collections
This commit is contained in:
@@ -4,7 +4,6 @@ using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Xml.Linq;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace API.Schema.MangaContext;
|
||||
@@ -15,8 +14,7 @@ public class Chapter : Identifiable, IComparable<Chapter>
|
||||
[StringLength(64)] [Required] public string ParentMangaId { get; init; } = null!;
|
||||
[JsonIgnore] public Manga ParentManga = null!;
|
||||
|
||||
[NotMapped]
|
||||
public Dictionary<string, string> IdsOnMangaConnectors =>
|
||||
[NotMapped] public Dictionary<string, string> IdsOnMangaConnectors =>
|
||||
MangaConnectorIds.ToDictionary(id => id.MangaConnectorName, id => id.IdOnConnectorSite);
|
||||
[JsonIgnore] public ICollection<MangaConnectorId<Chapter>> MangaConnectorIds = null!;
|
||||
|
||||
|
@@ -20,9 +20,9 @@ public class Manga : Identifiable
|
||||
[StringLength(64)] public string? LibraryId { get; private set; }
|
||||
[JsonIgnore] public FileLibrary? Library = null!;
|
||||
|
||||
public ICollection<Author> Authors { get; internal set; }= null!;
|
||||
public ICollection<MangaTag> MangaTags { get; internal set; }= null!;
|
||||
public ICollection<Link> Links { get; internal set; }= null!;
|
||||
public ICollection<Author> Authors { get; internal set; } = null!;
|
||||
public ICollection<MangaTag> MangaTags { get; internal set; } = null!;
|
||||
public ICollection<Link> Links { get; internal set; } = null!;
|
||||
public ICollection<AltTitle> AltTitles { get; internal set; } = null!;
|
||||
[Required] public float IgnoreChaptersBefore { get; internal set; }
|
||||
[StringLength(1024)] [Required] public string DirectoryName { get; private set; }
|
||||
|
@@ -1,6 +1,7 @@
|
||||
using System.Text.RegularExpressions;
|
||||
using JikanDotNet;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.ChangeTracking;
|
||||
|
||||
namespace API.Schema.MangaContext.MetadataFetchers;
|
||||
|
||||
@@ -47,6 +48,11 @@ public class MyAnimeList : MetadataFetcher
|
||||
public override void UpdateMetadata(MetadataEntry metadataEntry, MangaContext dbContext)
|
||||
{
|
||||
Manga dbManga = dbContext.Mangas.Find(metadataEntry.MangaId)!;
|
||||
|
||||
foreach (CollectionEntry collectionEntry in dbContext.Entry(dbManga).Collections)
|
||||
collectionEntry.Load();
|
||||
dbContext.Entry(dbManga).Navigation(nameof(Manga.Library)).Load();
|
||||
|
||||
MangaFull resultData;
|
||||
try
|
||||
{
|
||||
|
Reference in New Issue
Block a user