Add skin de-duplication

This commit is contained in:
Dean Herbert
2018-11-28 19:01:22 +09:00
parent 0bb8d5217c
commit ce660b6d67
5 changed files with 43 additions and 49 deletions

View File

@ -235,6 +235,7 @@ namespace osu.Game.Database
if (existing != null)
{
Undelete(existing);
Logger.Log($"Found existing {typeof(TModel)} for {item} (ID {existing.ID}). Skipping import.", LoggingTarget.Database);
return existing;
}
@ -471,6 +472,11 @@ namespace osu.Game.Database
{
}
/// <summary>
/// Check whether an existing model already exists for a new import item.
/// </summary>
/// <param name="model">The new model proposed for import. Note that <see cref="Populate"/> has not yet been run on this model.</param>
/// <returns>An existing model which matches the criteria to skip importing, else null.</returns>
protected virtual TModel CheckForExisting(TModel model) => null;
private DbSet<TModel> queryModel() => ContextFactory.Get().Set<TModel>();