Removes listening on legacy events for the CacheRefresherEventHandler

This commit is contained in:
Shannon
2015-01-22 12:17:36 +11:00
parent 42ad3af48b
commit 2cd92353ec
8 changed files with 83 additions and 179 deletions

View File

@@ -48,6 +48,7 @@ namespace Umbraco.Core.Cache
[Obsolete("This is no longer used and will be removed from the codebase in the future")]
public const string LanguageCacheKey = "UmbracoLanguageCache";
[Obsolete("This is no longer used and will be removed from the codebase in the future")]
public const string DomainCacheKey = "UmbracoDomainList";
[Obsolete("This is no longer used and will be removed from the codebase in the future")]

View File

@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Umbraco.Core.Events;
using Umbraco.Core.Logging;
using Umbraco.Core.Models;
using Umbraco.Core.Persistence;
@@ -9,8 +10,6 @@ using Umbraco.Core.Persistence.UnitOfWork;
namespace Umbraco.Core.Services
{
//TODO: Add events!
public class DomainService : RepositoryService, IDomainService
{
public DomainService(IDatabaseUnitOfWorkProvider provider, RepositoryFactory repositoryFactory, ILogger logger)
@@ -29,12 +28,18 @@ namespace Umbraco.Core.Services
public void Delete(IDomain domain)
{
if (Deleting.IsRaisedEventCancelled(new DeleteEventArgs<IDomain>(domain), this))
return;
var uow = UowProvider.GetUnitOfWork();
using (var repository = RepositoryFactory.CreateDomainRepository(uow))
{
repository.Delete(domain);
uow.Commit();
uow.Commit();
}
var args = new DeleteEventArgs<IDomain>(domain, false);
Deleted.RaiseEvent(args, this);
}
public IDomain GetByName(string name)
@@ -77,8 +82,8 @@ namespace Umbraco.Core.Services
{
if (raiseEvents)
{
//if (Saving.IsRaisedEventCancelled(new SaveEventArgs<IContent>(content), this))
// return;
if (Saving.IsRaisedEventCancelled(new SaveEventArgs<IDomain>(domainEntity), this))
return;
}
var uow = UowProvider.GetUnitOfWork();
@@ -88,8 +93,32 @@ namespace Umbraco.Core.Services
uow.Commit();
}
//if (raiseEvents)
// Saved.RaiseEvent(new SaveEventArgs<IContent>(content, false), this);
if (raiseEvents)
Saved.RaiseEvent(new SaveEventArgs<IDomain>(domainEntity, false), this);
}
#region Event Handlers
/// <summary>
/// Occurs before Delete
/// </summary>
public static event TypedEventHandler<IDomainService, DeleteEventArgs<IDomain>> Deleting;
/// <summary>
/// Occurs after Delete
/// </summary>
public static event TypedEventHandler<IDomainService, DeleteEventArgs<IDomain>> Deleted;
/// <summary>
/// Occurs before Save
/// </summary>
public static event TypedEventHandler<IDomainService, SaveEventArgs<IDomain>> Saving;
/// <summary>
/// Occurs after Save
/// </summary>
public static event TypedEventHandler<IDomainService, SaveEventArgs<IDomain>> Saved;
#endregion
}
}