Fix removal of FileInfo, BeatmapMetadata, BeatmapDifficulty objects

This commit is contained in:
TocoToucan
2017-10-15 14:01:35 +03:00
parent 7cf5d63cd3
commit db2750592d
8 changed files with 192 additions and 172 deletions

View File

@ -73,6 +73,11 @@ namespace osu.Game.Beatmaps
if (beatmapSet.DeletePending) return false;
beatmapSet.DeletePending = true;
// We can't use one to one relationship with its cascade delete because FileInfo can be used not only inside of BeatmapSetFileInfo
var files = beatmapSet.Files.Select(beatmapSetFileInfo => beatmapSetFileInfo.FileInfo);
Connection.FileInfo.RemoveRange(files);
Connection.BeatmapSetInfo.Remove(beatmapSet);
Connection.SaveChanges();