More story fixes
This commit is contained in:
@@ -51,4 +51,15 @@ public class StoryMasterRepository : IStoryMasterRepository
|
||||
|
||||
public Task<SpecialBattleSetting?> GetSbsByIdAsync(int sbsId)
|
||||
=> _db.SpecialBattleSettings.FirstOrDefaultAsync(s => s.Id == sbsId);
|
||||
|
||||
public async Task<StorySubChapter?> FindSubChapterByStoryIdAsync(int storyId)
|
||||
{
|
||||
// StorySubChapter is an owned entity (no DbSet of its own); query through the owning
|
||||
// chapter. SelectMany over the owned collection translates to a JOIN in the relational
|
||||
// provider — no need to materialize the full chapter row.
|
||||
return await _db.StoryChapters
|
||||
.AsNoTracking()
|
||||
.SelectMany(c => c.SubChapters)
|
||||
.FirstOrDefaultAsync(sc => sc.SubChapterStoryId == storyId);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user