1
0
mirror of https://github.com/ppy/osu.git synced 2025-02-20 04:23:14 +08:00

Remove ValidTypes from databased stored; explicitly expose query methods instead

This commit is contained in:
Dean Herbert 2017-10-16 14:47:33 +09:00
parent 1a16784db9
commit 7049a73490
6 changed files with 0 additions and 32 deletions

View File

@ -26,14 +26,6 @@ namespace osu.Game.Beatmaps
{
}
protected override Type[] ValidTypes => new[]
{
typeof(BeatmapSetInfo),
typeof(BeatmapInfo),
typeof(BeatmapMetadata),
typeof(BeatmapDifficulty),
};
protected override void Prepare(bool reset = false)
{
if (reset)

View File

@ -2,7 +2,6 @@
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System;
using System.Linq;
using Microsoft.EntityFrameworkCore;
using osu.Framework.Logging;
using osu.Framework.Platform;
@ -47,13 +46,5 @@ namespace osu.Game.Database
/// Reset this database to a default state. Undo all changes to database and storage backings.
/// </summary>
public void Reset() => Prepare(true);
private void checkType(Type type)
{
if (!ValidTypes.Contains(type))
throw new InvalidOperationException($"The requested operation specified a type of {type}, which is invalid for this {nameof(DatabaseBackedStore)}.");
}
protected abstract Type[] ValidTypes { get; }
}
}

View File

@ -27,10 +27,6 @@ namespace osu.Game.IO
Store = new NamespacedResourceStore<byte[]>(new StorageBackedResourceStore(storage), prefix);
}
protected override Type[] ValidTypes => new[] {
typeof(FileInfo),
};
protected override void Prepare(bool reset = false)
{
if (reset)

View File

@ -1,7 +1,6 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.EntityFrameworkCore;
@ -57,11 +56,6 @@ namespace osu.Game.Input
}
}
protected override Type[] ValidTypes => new[]
{
typeof(DatabasedKeyBinding)
};
public List<KeyBinding> Query(int? rulesetId = null, int? variant = null) =>
new List<KeyBinding>(Connection.DatabasedKeyBinding.Where(b => b.RulesetID == rulesetId && b.Variant == variant));

View File

@ -109,8 +109,6 @@ namespace osu.Game.Rulesets
ID = ruleset.LegacyID
};
protected override Type[] ValidTypes => new[] { typeof(RulesetInfo) };
public RulesetInfo GetRuleset(int id) => Connection.RulesetInfo.First(r => r.ID == id);
public RulesetInfo QueryRulesetInfo(Func<RulesetInfo, bool> query)

View File

@ -1,7 +1,6 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System;
using System.Collections.Generic;
using System.IO;
using osu.Framework.Platform;
@ -147,7 +146,5 @@ namespace osu.Game.Rulesets.Scoring
protected override void Prepare(bool reset = false)
{
}
protected override Type[] ValidTypes => new[] { typeof(Score) };
}
}