Return back DatabaseBackedStore's query and populate functions

This commit is contained in:
TocoToucan
2017-10-15 00:40:41 +03:00
parent 5f083f10a7
commit 7cf5d63cd3
10 changed files with 117 additions and 80 deletions

View File

@ -6,12 +6,13 @@ using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using Newtonsoft.Json;
using osu.Game.Database;
using osu.Game.IO.Serialization;
using osu.Game.Rulesets;
namespace osu.Game.Beatmaps
{
public class BeatmapInfo : IEquatable<BeatmapInfo>, IJsonSerializable
public class BeatmapInfo : IEquatable<BeatmapInfo>, IJsonSerializable, IPopulate
{
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int ID { get; set; }
@ -124,5 +125,11 @@ namespace osu.Game.Beatmaps
public bool BackgroundEquals(BeatmapInfo other) => other != null && BeatmapSet != null && other.BeatmapSet != null &&
BeatmapSet.Hash == other.BeatmapSet.Hash &&
(Metadata ?? BeatmapSet.Metadata).BackgroundFile == (other.Metadata ?? other.BeatmapSet.Metadata).BackgroundFile;
public void Populate(OsuDbContext connection)
{
var entry = connection.Entry(this);
entry.Reference<BeatmapDifficulty>(nameof(Difficulty));
}
}
}