* Add parent key to CopyingNotification * Use parentkey on notifications * Implement ParentKeys for Copying notification * Obsolete parentId * Implement MoveToEventInfoBase * Refactor MovingToRecycleBinNotification to use the new MoveEVentInfoBase * Refactor MediaMovingToRecycleBinNotification * Refactor MovedToRecycleBinNotification to use new MoveEventInfo * Refactor ContentMovedToRecycleBinNotification to use new MoveEventInfo * Start implementing parent key in moveinfo * Add FIXME's to move methods * Refactor Move to get parentKey for descendants * Add FIXME for move method * Use MoveToRecycleBinEventInfo in RelateOnTrashNotificationHandler * Add fixme's to DataTypeRepository * Add obsolete messages * Revert changes in ContentTypeServiceBaseOfTRepositoryTItemTService.cs * Fix bad indentation * Pass the recursive variable * Revert changes in ContentService.cs * Refactor MoveEventInfo to not duplicate equals method * Refactor Equals to not duplicate code * Add UnitTests of Equals * make equals public and add non-happy path tests * Remvoe duplicate call to base --------- Co-authored-by: Zeegaan <nge@umbraco.dk>
39 lines
993 B
C#
39 lines
993 B
C#
namespace Umbraco.Cms.Core.Events;
|
|
|
|
public abstract class MoveEventInfoBase<TEntity> : IEquatable<MoveEventInfoBase<TEntity>>
|
|
{
|
|
public MoveEventInfoBase(TEntity entity, string originalPath)
|
|
{
|
|
Entity = entity;
|
|
OriginalPath = originalPath;
|
|
}
|
|
|
|
public TEntity Entity { get; set; }
|
|
|
|
public string OriginalPath { get; set; }
|
|
|
|
public bool Equals(MoveEventInfoBase<TEntity>? other)
|
|
{
|
|
if (ReferenceEquals(null, other))
|
|
{
|
|
return false;
|
|
}
|
|
|
|
if (ReferenceEquals(this, other))
|
|
{
|
|
return true;
|
|
}
|
|
|
|
if (other.GetType() != this.GetType())
|
|
{
|
|
return false;
|
|
}
|
|
|
|
return EqualityComparer<TEntity>.Default.Equals(Entity, other.Entity) && OriginalPath == other.OriginalPath;
|
|
}
|
|
|
|
public override bool Equals(object? obj) => Equals((MoveEventInfoBase<TEntity>?) obj);
|
|
|
|
public override int GetHashCode() => HashCode.Combine(Entity, OriginalPath);
|
|
}
|