/// <summary> /// 触发 <see cref="Saved"/> 事件. /// </summary> protected virtual void OnSaved(DomainObjectBase <TID> businessObject, SaveAction action) { if (Saved != null) { Saved(businessObject, new SavedEventArgs(action)); } }
/// <summary> /// 判断两个对象是否是同一个领域对象,如果两个对象 <see cref="ID"/> 不是默认值且值相等,则认为是同一对象,返回true; /// 否则返回false。 /// </summary> private bool HasSameNonDefaultIdAs(DomainObjectBase <TID> compareTo) { Check.Require(compareTo == null, "compareTo may not be null"); return((ID != null && !ID.Equals(default(TID))) && (compareTo.ID != null && !compareTo.ID.Equals(default(TID))) && ID.Equals(compareTo.ID)); }
/// <summary> /// 触发 <see cref="Saving"/> 事件. /// </summary> protected virtual SavedEventArgs OnSaving(DomainObjectBase <TID> businessObject, SaveAction action) { if (Saving != null) { SavedEventArgs arge = new SavedEventArgs(action); Saving(businessObject, arge); return(arge); } return(null); }
public override bool Equals(object obj) { DomainObjectBase <TID> compareTo = obj as DomainObjectBase <TID>; return((compareTo != null) && (HasSameNonDefaultIdAs(compareTo) || // Since the IDs aren't the same, either of them must be transient to // compare business value signatures (((IsTransient()) || compareTo.IsTransient()) && HasSameBusinessSignatureAs(compareTo)))); }
private bool HasSameBusinessSignatureAs(DomainObjectBase <TID> compareTo) { Check.Require(compareTo == null, "compareTo may not be null"); return(GetHashCode().Equals(compareTo.GetHashCode())); }