1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-22 15:27:26 +08:00

Update soft-deletion logic to use model store's consumable items instead

This commit is contained in:
Salman Ahmed 2021-01-04 07:46:51 +03:00
parent df04dd21de
commit 738c94d193

View File

@ -76,7 +76,7 @@ namespace osu.Game.Database
protected readonly IDatabaseContextFactory ContextFactory;
protected readonly MutableDatabaseBackedStore<TModel> ModelStore;
protected readonly MutableDatabaseBackedStoreWithFileIncludes<TModel, TFileModel> ModelStore;
// ReSharper disable once NotAccessedField.Local (we should keep a reference to this so it is not finalised)
private ArchiveImportIPCChannel ipc;
@ -492,7 +492,7 @@ namespace osu.Game.Database
using (ContextFactory.GetForWrite())
{
// re-fetch the model on the import context.
var foundModel = queryModel().Include(s => s.Files).ThenInclude(f => f.FileInfo).FirstOrDefault(s => s.ID == item.ID);
var foundModel = ModelStore.ConsumableItems.SingleOrDefault(i => i.ID == item.ID);
if (foundModel == null || foundModel.DeletePending) return false;
@ -731,8 +731,6 @@ namespace osu.Game.Database
yield return f.Filename;
}
private DbSet<TModel> queryModel() => ContextFactory.Get().Set<TModel>();
protected virtual string HumanisedModelName => $"{typeof(TModel).Name.Replace("Info", "").ToLower()}";
#region Event handling / delaying