/// <summary> /// in order to clone the object we use BinaryFormatter /// </summary> private IIdentifiableByNumber Clone(IIdentifiableByNumber item) { var formatter = new BinaryFormatter(); using (var stream = new MemoryStream()) { formatter.Serialize(stream, item); stream.Flush(); stream.Seek(0, SeekOrigin.Begin); return((IIdentifiableByNumber)formatter.Deserialize(stream)); } }
public NewEntity(IIdentifiableByNumber item) { this.Value = item; }
public ExistingEntity(IIdentifiableByNumber item) { this.Value = item; this._existingValue = Clone(item); }