From 5e941a1c3a2bf583745fb8f8bc8d852b3a02618c Mon Sep 17 00:00:00 2001 From: Shannon Deminick Date: Sun, 16 Dec 2012 04:10:39 +0500 Subject: [PATCH] Changed CollectionSaved event naming to be consistent so is renamed SavedCollection (etc). Now we have no more IEnumerable> collections, we can easily strongly type the event args instead of just IEnumerable, they are now IEnumerable. --- src/Umbraco.Core/Services/ContentService.cs | 8 +++---- .../Services/ContentTypeService.cs | 22 ++++++++++++++----- src/Umbraco.Core/Services/MediaService.cs | 8 +++---- 3 files changed, 24 insertions(+), 14 deletions(-) diff --git a/src/Umbraco.Core/Services/ContentService.cs b/src/Umbraco.Core/Services/ContentService.cs index 65ab78db7c..7143c6ae8b 100644 --- a/src/Umbraco.Core/Services/ContentService.cs +++ b/src/Umbraco.Core/Services/ContentService.cs @@ -696,7 +696,7 @@ namespace Umbraco.Core.Services /// Optional Id of the User saving the Content public void Save(IEnumerable contents, int userId = -1) { - if (CollectionSaving.IsRaisedEventCancelled(new SaveEventArgs(contents), this)) + if (SavingCollection.IsRaisedEventCancelled(new SaveEventArgs>(contents), this)) return; var uow = _uowProvider.GetUnitOfWork(); @@ -730,7 +730,7 @@ namespace Umbraco.Core.Services //Commit everything in one go uow.Commit(); - CollectionSaved.RaiseEvent(new SaveEventArgs(contents, false), this); + SavedCollection.RaiseEvent(new SaveEventArgs>(contents, false), this); Audit.Add(AuditTypes.Save, "Bulk Save content performed by user", userId == -1 ? 0 : userId, -1); } @@ -1300,12 +1300,12 @@ namespace Umbraco.Core.Services /// /// Occurs before saving a collection /// - public static event TypedEventHandler> CollectionSaving; + public static event TypedEventHandler>> SavingCollection; /// /// Occurs after saving a collection /// - public static event TypedEventHandler> CollectionSaved; + public static event TypedEventHandler>> SavedCollection; /// /// Occurs before Create diff --git a/src/Umbraco.Core/Services/ContentTypeService.cs b/src/Umbraco.Core/Services/ContentTypeService.cs index 755ec084c7..397153ce9d 100644 --- a/src/Umbraco.Core/Services/ContentTypeService.cs +++ b/src/Umbraco.Core/Services/ContentTypeService.cs @@ -139,7 +139,7 @@ namespace Umbraco.Core.Services /// Optional id of the user saving the ContentType public void Save(IEnumerable contentTypes, int userId = -1) { - if (CollectionSaving.IsRaisedEventCancelled(new SaveEventArgs(contentTypes), this)) + if (SavingContentTypeCollection.IsRaisedEventCancelled(new SaveEventArgs>(contentTypes), this)) return; var uow = _uowProvider.GetUnitOfWork(); @@ -154,7 +154,7 @@ namespace Umbraco.Core.Services //save it all in one go uow.Commit(); - CollectionSaved.RaiseEvent(new SaveEventArgs(contentTypes, false), this); + SavedContentTypeCollection.RaiseEvent(new SaveEventArgs>(contentTypes, false), this); } Audit.Add(AuditTypes.Save, string.Format("Save ContentTypes performed by user"), userId == -1 ? 0 : userId, -1); @@ -317,7 +317,7 @@ namespace Umbraco.Core.Services /// Optional Id of the user savging the MediaTypes public void Save(IEnumerable mediaTypes, int userId = -1) { - if (CollectionSaving.IsRaisedEventCancelled(new SaveEventArgs(mediaTypes), this)) + if (SavingMediaTypeCollection.IsRaisedEventCancelled(new SaveEventArgs>(mediaTypes), this)) return; var uow = _uowProvider.GetUnitOfWork(); @@ -333,7 +333,7 @@ namespace Umbraco.Core.Services //save it all in one go uow.Commit(); - CollectionSaved.RaiseEvent(new SaveEventArgs(mediaTypes, false), this); + SavedMediaTypeCollection.RaiseEvent(new SaveEventArgs>(mediaTypes, false), this); } Audit.Add(AuditTypes.Save, string.Format("Save MediaTypes performed by user"), userId == -1 ? 0 : userId, -1); @@ -538,12 +538,22 @@ namespace Umbraco.Core.Services /// /// Occurs before saving a collection /// - public static event TypedEventHandler> CollectionSaving; + public static event TypedEventHandler>> SavingContentTypeCollection; /// /// Occurs after saving a collection /// - public static event TypedEventHandler> CollectionSaved; + public static event TypedEventHandler>> SavedContentTypeCollection; + + /// + /// Occurs before saving a collection + /// + public static event TypedEventHandler>> SavingMediaTypeCollection; + + /// + /// Occurs after saving a collection + /// + public static event TypedEventHandler>> SavedMediaTypeCollection; #endregion } diff --git a/src/Umbraco.Core/Services/MediaService.cs b/src/Umbraco.Core/Services/MediaService.cs index 69d1f2b9f2..3f558de1fc 100644 --- a/src/Umbraco.Core/Services/MediaService.cs +++ b/src/Umbraco.Core/Services/MediaService.cs @@ -365,7 +365,7 @@ namespace Umbraco.Core.Services var uow = _uowProvider.GetUnitOfWork(); using (var repository = _repositoryFactory.CreateMediaRepository(uow)) { - if (CollectionSaving.IsRaisedEventCancelled(new SaveEventArgs(medias), this)) + if (SavingCollection.IsRaisedEventCancelled(new SaveEventArgs>(medias), this)) return; foreach (var media in medias) @@ -377,7 +377,7 @@ namespace Umbraco.Core.Services //commit the whole lot in one go uow.Commit(); - CollectionSaved.RaiseEvent(new SaveEventArgs(medias, false), this); + SavedCollection.RaiseEvent(new SaveEventArgs>(medias, false), this); Audit.Add(AuditTypes.Save, "Save Media items performed by user", userId == -1 ? 0 : userId, -1); } @@ -447,12 +447,12 @@ namespace Umbraco.Core.Services /// /// Occurs before saving a collection /// - public static event TypedEventHandler> CollectionSaving; + public static event TypedEventHandler>> SavingCollection; /// /// Occurs after saving a collection /// - public static event TypedEventHandler> CollectionSaved; + public static event TypedEventHandler>> SavedCollection; /// /// Occurs before Create