Exemplo n.º 1
0
        /// ------------------------------------------------------------------------------------------------------------
        /// <summary>
        ///
        /// </summary>
        /// ------------------------------------------------------------------------------------------------------------
        public new virtual bool Equals(object obj)
        {
            AbstractDomainObject <TId> compareTo = obj as AbstractDomainObject <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))));
        }
Exemplo n.º 2
0
 /// ------------------------------------------------------------------------------------------------------------
 /// <summary>
 /// Returns true if self and the provided persistent object have the same Id values
 /// and the Ids are not of the default Id value
 /// </summary>
 /// ------------------------------------------------------------------------------------------------------------
 private bool HasSameNonDefaultIdAs(AbstractDomainObject <TId> compareTo)
 {
     return((Id != null && !Id.Equals(default(TId))) && (compareTo.Id != null && !compareTo.Id.Equals(default(TId))) && Id.Equals(compareTo.Id));
 }
Exemplo n.º 3
0
 /// ------------------------------------------------------------------------------------------------------------
 /// <summary>
 ///
 /// </summary>
 /// ------------------------------------------------------------------------------------------------------------
 private bool HasSameBusinessSignatureAs(AbstractDomainObject <TId> compareTo)
 {
     return(this.GetHashCode().Equals(compareTo.GetHashCode()));
 }