mirror of
https://github.com/osukey/osukey.git
synced 2025-08-05 15:44:04 +09:00
Extract requerying of navigational properties from DbContext
This commit is contained in:
@ -54,19 +54,7 @@ namespace osu.Game.Scoring
|
||||
|
||||
protected override void PreImport(ScoreInfo model)
|
||||
{
|
||||
var dbContext = ContextFactory.Get();
|
||||
|
||||
// Workaround System.InvalidOperationException
|
||||
// The instance of entity type 'FileInfo' cannot be tracked because another instance with the same key value for {'ID'} is already being tracked.
|
||||
foreach (var file in model.Files)
|
||||
{
|
||||
file.FileInfo = dbContext.FileInfo.Find(file.FileInfoID);
|
||||
}
|
||||
|
||||
foreach (var file in model.Beatmap.BeatmapSet.Files)
|
||||
{
|
||||
file.FileInfo = dbContext.FileInfo.Find(file.FileInfoID);
|
||||
}
|
||||
model.Requery(ContextFactory);
|
||||
}
|
||||
|
||||
protected override ScoreInfo CreateModel(ArchiveReader archive)
|
||||
|
Reference in New Issue
Block a user