/// <summary> /// Implement semantics that cannot be specified while creating an instance of the object. /// </summary> /// <remarks> /// This function is not called when cloning read only objects. /// </remarks> protected virtual void CloneOverride(CloneableObject clone) { }
/// <summary> /// Implement semantics that cannot be specified while creating an instance of the object. /// </summary> /// <remarks> /// This function cannot be overriden from this point on or the contract of this /// class will break. To support cloning all properties must be properly registered. /// </remarks> /// <param name="clone">Clonable object.</param> protected override sealed void CloneOverride(CloneableObject clone) { var instance = (HierarchicalObject)clone; // Shallowly copy the parent. instance._hierarchyParent = _hierarchyParent; foreach (var propertyMapping in _ownValues) { // The property representative. var property = propertyMapping.Key; // The value owned by this object. var value = propertyMapping.Value; // Set value for this property on the clone. instance.SetValue(property, property.Clone(value)); } }
/// <summary> /// Initializes a new instance of the <see cref="Pablo.CloneException"/> class. /// </summary> internal CloneException(string message, Exception innerException, Type targetType, CloneableObject targetObject) : base(message, innerException) { TargetType = targetType; _targetObject = targetObject; }