mirror of
https://github.com/osukey/osukey.git
synced 2025-08-04 15:16:38 +09:00
Automate includes of files in ArchiveModelManager use cases
This commit is contained in:
@ -108,7 +108,7 @@ namespace osu.Game.Database
|
||||
a.Invoke();
|
||||
}
|
||||
|
||||
protected ArchiveModelManager(Storage storage, IDatabaseContextFactory contextFactory, MutableDatabaseBackedStore<TModel> modelStore, IIpcHost importHost = null)
|
||||
protected ArchiveModelManager(Storage storage, IDatabaseContextFactory contextFactory, MutableDatabaseBackedStoreWithFileIncludes<TModel, TFileModel> modelStore, IIpcHost importHost = null)
|
||||
{
|
||||
ContextFactory = contextFactory;
|
||||
|
||||
|
@ -0,0 +1,23 @@
|
||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using System.Linq;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using osu.Framework.Platform;
|
||||
|
||||
namespace osu.Game.Database
|
||||
{
|
||||
public abstract class MutableDatabaseBackedStoreWithFileIncludes<T, U> : MutableDatabaseBackedStore<T>
|
||||
where T : class, IHasPrimaryKey, ISoftDelete, IHasFiles<U>
|
||||
where U : INamedFileInfo
|
||||
{
|
||||
protected MutableDatabaseBackedStoreWithFileIncludes(IDatabaseContextFactory contextFactory, Storage storage = null)
|
||||
: base(contextFactory, storage)
|
||||
{
|
||||
}
|
||||
|
||||
protected override IQueryable<T> AddIncludesForConsumption(IQueryable<T> query) =>
|
||||
base.AddIncludesForConsumption(query)
|
||||
.Include(s => s.Files).ThenInclude(f => f.FileInfo);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user