示例#1
0
 public override void Merge(AutumnModel other)
 {
     var source = other as Contact;
     if (source != null)
     {
         this.Name = source.Name;
         this.Age = source.Age;
         this.Email = source.Email;
     }
 }
示例#2
0
        /// <summary>
        /// Merges this model with another instance of the same type.  Not implemented
        /// in the base class.
        /// </summary>
        /// <param name="other"></param>
        public virtual void Merge(AutumnModel other)
        {
            if (other.GetType() != this.GetType())
                throw new ArgumentException("Cannot merge item of a different type.");
            if (this.Id > 0 && other.Id != this.Id)
                throw new ArgumentException("Cannot merge item with a different id.");

            //If a derived class wants this to work, they'll need to implement it.
            throw new NotImplementedException();
        }