示例#1
0
        /// <summary>
        /// Equals.
        /// </summary>
        /// <param name="other">other.</param>
        /// <returns>bool.</returns>
        public virtual bool Equals(BaseDeletableModel <TKey> other)
        {
            if (other == null)
            {
                return(false);
            }

            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            if (IsTransient(this) || IsTransient(other) || !Equals(this.Id, other.Id))
            {
                return(false);
            }

            var otherType = other.GetUnproxiedType();
            var thisType  = this.GetUnproxiedType();

            return(thisType.IsAssignableFrom(otherType) || otherType.IsAssignableFrom(thisType));
        }
示例#2
0
 /// <summary>
 /// Is transient.
 /// </summary>
 /// <param name="obj">obj.</param>
 /// <returns>bool.</returns>
 private static bool IsTransient(BaseDeletableModel <TKey> obj)
 {
     return(obj != null && Equals(obj.Id, default(int)));
 }