More work on deep cloning, have test passing for IContent
This commit is contained in:
@@ -96,7 +96,7 @@ namespace Umbraco.Core.Models.EntityBase
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// /// 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.
|
||||
@@ -158,6 +158,7 @@ namespace Umbraco.Core.Models.EntityBase
|
||||
/// <summary>
|
||||
/// Indicates whether the current entity has an identity, eg. Id.
|
||||
/// </summary>
|
||||
[DataMember]
|
||||
public virtual bool HasIdentity
|
||||
{
|
||||
get
|
||||
@@ -230,13 +231,13 @@ namespace Umbraco.Core.Models.EntityBase
|
||||
return _hash.Value;
|
||||
}
|
||||
|
||||
public virtual T DeepClone<T>() where T : IDeepCloneable
|
||||
public virtual object DeepClone()
|
||||
{
|
||||
//Memberwise clone on Entity will work since it doesn't have any deep elements
|
||||
// for any sub class this will work for standard properties as well that aren't complex object's themselves.
|
||||
var clone = MemberwiseClone();
|
||||
((TracksChangesEntityBase)clone).ResetDirtyProperties(true);
|
||||
return (T)clone;
|
||||
return clone;
|
||||
|
||||
//Using data contract serializer - has issues
|
||||
|
||||
|
||||
@@ -2,6 +2,6 @@ namespace Umbraco.Core.Models.EntityBase
|
||||
{
|
||||
public interface IDeepCloneable
|
||||
{
|
||||
T DeepClone<T>() where T : IDeepCloneable;
|
||||
object DeepClone();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user