Updating Template to have a lazy master template id.
Adding a few new methods to the DataTypeService, which were needed for the import of DataTypes. Adding bulk saving of templates. Adding TopologicalSorter for sorting dependencies. Implementing import of DataTypes and Templates. Renaming the import test fixture for consistency after having creating the PackagingService.
This commit is contained in:
@@ -255,6 +255,31 @@ namespace Umbraco.Core.Services
|
||||
Audit.Add(AuditTypes.Save, string.Format("Save Template performed by user"), userId, template.Id);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Saves a collection of <see cref="Template"/> objects
|
||||
/// </summary>
|
||||
/// <param name="templates">List of <see cref="Template"/> to save</param>
|
||||
/// <param name="userId">Optional id of the user</param>
|
||||
public void SaveTemplate(IEnumerable<ITemplate> templates, int userId = 0)
|
||||
{
|
||||
if (SavingTemplate.IsRaisedEventCancelled(new SaveEventArgs<ITemplate>(templates), this))
|
||||
return;
|
||||
|
||||
var uow = _dataUowProvider.GetUnitOfWork();
|
||||
using (var repository = _repositoryFactory.CreateTemplateRepository(uow))
|
||||
{
|
||||
foreach (var template in templates)
|
||||
{
|
||||
repository.AddOrUpdate(template);
|
||||
}
|
||||
uow.Commit();
|
||||
|
||||
SavedTemplate.RaiseEvent(new SaveEventArgs<ITemplate>(templates, false), this);
|
||||
}
|
||||
|
||||
Audit.Add(AuditTypes.Save, string.Format("Save Template performed by user"), userId, -1);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Deletes a template by its alias
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user