Esempio n. 1
0
        /// <summary>
        /// Gets a value indicating whether the current instance and a given other entity are identity-equal.
        /// </summary>
        /// <returns><c>true</c>, if the current instance is identity-equal to the given instance, <c>false</c> otherwise.</returns>
        /// <param name="other">Other.</param>
        public virtual bool IdentityEquals(IEntity other)
        {
            if (ReferenceEquals(other, null))
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return(Identity.Equals(this, other));
        }
Esempio n. 2
0
        /// <summary>
        /// Gets a value indicating whether two given entity instances are equal.  For this comparison, entities
        /// are considered equal if they are either reference equal, or identity equal.
        /// </summary>
        /// <param name="one">The first entity</param>
        /// <param name="two">The second entity</param>
        public static bool operator ==(Entity <TIdentity> one, IEntity two)
        {
            if (ReferenceEquals(one, two))
            {
                return(true);
            }
            if (ReferenceEquals(one, null))
            {
                return(false);
            }

            return(Identity.Equals(one, two));
        }