Exemplo n.º 1
0
        /// <summary>
        /// Serves as a hash function for a <see cref="T:CSF.Entities.Entity{TIdentity}"/> object.
        /// </summary>
        /// <returns>
        /// A hash code for this instance that is suitable for use in hashing algorithms and data structures such as a
        /// hash table.
        /// </returns>
        public override int GetHashCode()
        {
            if (!_cachedHashCode.HasValue)
            {
                if (HasIdentity)
                {
                    _cachedHashCode = IdentityValue.GetHashCode();
                }
                else
                {
                    _cachedHashCode = base.GetHashCode();
                }
            }

            return(_cachedHashCode.Value);
        }
Exemplo n.º 2
0
 /// <summary>
 /// Get hash code
 /// </summary>
 /// <returns>Return model hash code</returns>
 public sealed override int GetHashCode()
 {
     return(IdentityValue.GetHashCode());
 }