Adds ability to bulk insert relations and adds tests

This commit is contained in:
Shannon
2019-11-06 16:45:28 +11:00
parent f7e8a53922
commit 049d51e466
6 changed files with 175 additions and 25 deletions

View File

@@ -417,6 +417,24 @@ namespace Umbraco.Core.Services.Implement
}
}
public void Save(IEnumerable<IRelation> relations)
{
using (var scope = ScopeProvider.CreateScope())
{
var saveEventArgs = new SaveEventArgs<IRelation>(relations);
if (scope.Events.DispatchCancelable(SavingRelation, this, saveEventArgs))
{
scope.Complete();
return;
}
_relationRepository.Save(relations);
scope.Complete();
saveEventArgs.CanCancel = false;
scope.Events.Dispatch(SavedRelation, this, saveEventArgs);
}
}
/// <inheritdoc />
public void Save(IRelationType relationType)
{