public void CopyStateAndVersion(Persistable source) { this.SetVersion(source.Version); switch (source.State) { case PersistableState.Deleted: this.Deleted(); break; case PersistableState.Modified: this.Modified(); break; case PersistableState.New: this.Added(); break; case PersistableState.Unchanged: default: throw new InvalidOperationException(); } }
/// <summary> /// Instantiates the new instance of persistable object from the existing object by copying the state and version from the existing object /// </summary> /// <param name="persistable">Persistable object to be copied from</param> public Persistable(Persistable persistable) : this(persistable.State, persistable.Version) { }