Changed event handler to AfterDelete for DataTypeDefinition, fixes merge issue with Entity and changes WasCancelled to be tracked.
This commit is contained in:
@@ -19,12 +19,14 @@ namespace Umbraco.Core.Models.EntityBase
|
||||
private Guid _key;
|
||||
private DateTime _createDate;
|
||||
private DateTime _updateDate;
|
||||
private bool _wasCancelled;
|
||||
|
||||
private static readonly PropertyInfo IdSelector = ExpressionHelper.GetPropertyInfo<Entity, int>(x => x.Id);
|
||||
private static readonly PropertyInfo KeySelector = ExpressionHelper.GetPropertyInfo<Entity, Guid>(x => x.Key);
|
||||
private static readonly PropertyInfo CreateDateSelector = ExpressionHelper.GetPropertyInfo<Entity, DateTime>(x => x.CreateDate);
|
||||
private static readonly PropertyInfo UpdateDateSelector = ExpressionHelper.GetPropertyInfo<Entity, DateTime>(x => x.UpdateDate);
|
||||
private static readonly PropertyInfo HasIdentitySelector = ExpressionHelper.GetPropertyInfo<Entity, bool>(x => x.HasIdentity);
|
||||
private static readonly PropertyInfo WasCancelledSelector = ExpressionHelper.GetPropertyInfo<Entity, bool>(x => x.WasCancelled);
|
||||
|
||||
|
||||
/// <summary>
|
||||
@@ -91,19 +93,30 @@ namespace Umbraco.Core.Models.EntityBase
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the Modified Date
|
||||
/// </summary>
|
||||
[DataMember]
|
||||
public DateTime UpdateDate
|
||||
/// Gets or sets the WasCancelled flag, which is used to track
|
||||
/// /// Gets or sets the WasCancelled flag, which is used to track
|
||||
/// whether some action against an entity was cancelled through some event.
|
||||
/// This only exists so we have a way to check if an event was cancelled through
|
||||
/// the new api, which also needs to take effect in the legacy api.
|
||||
/// </summary>
|
||||
[IgnoreDataMember]
|
||||
internal bool WasCancelled { get; set; }
|
||||
internal bool WasCancelled
|
||||
{
|
||||
get { return _wasCancelled; }
|
||||
set
|
||||
{
|
||||
SetPropertyValueAndDetectChanges(o =>
|
||||
{
|
||||
_wasCancelled = value;
|
||||
return _wasCancelled;
|
||||
}, _wasCancelled, WasCancelledSelector);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the Modified Date
|
||||
/// </summary>
|
||||
[DataMember]
|
||||
public DateTime UpdateDate
|
||||
{
|
||||
get { return _updateDate; }
|
||||
set
|
||||
|
||||
@@ -26,7 +26,7 @@ namespace Umbraco.Web.Cache
|
||||
//Bind to data type events
|
||||
//NOTE: we need to bind to legacy and new API events currently: http://issues.umbraco.org/issue/U4-1979
|
||||
|
||||
global::umbraco.cms.businesslogic.datatype.DataTypeDefinition.Deleting += DataTypeDefinitionDeleting;
|
||||
global::umbraco.cms.businesslogic.datatype.DataTypeDefinition.AfterDelete += DataTypeDefinitionDeleting;
|
||||
global::umbraco.cms.businesslogic.datatype.DataTypeDefinition.Saving += DataTypeDefinitionSaving;
|
||||
DataTypeService.Deleted += DataTypeServiceDeleted;
|
||||
DataTypeService.Saved += DataTypeServiceSaved;
|
||||
|
||||
Reference in New Issue
Block a user