Example #1
0
            /// <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));
                }
            }
Example #2
0
 public NewEntity(IIdentifiableByNumber item)
 {
     this.Value = item;
 }
Example #3
0
 public ExistingEntity(IIdentifiableByNumber item)
 {
     this.Value          = item;
     this._existingValue = Clone(item);
 }