Ejemplo n.º 1
0
        public override int GetHashCode()
        {
            var h1   = Sql.GetHashCode();
            var h2   = CommandType.GetHashCode();
            var h3   = Connection.GetHashCode();
            var h4   = TargetType.GetHashCode();
            var h5   = ParameterType is null ? h1 : ParameterType.GetHashCode();
            var code =
                L(h1, 1) |
                R(h2, 27) |
                R(h3, 27) |
                L(h4, 2) |
                L(h5, 3);

            return((int)code);
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Returns the hash code for the command
 /// </summary>
 /// <returns>The hash code for the object</returns>
 public override int GetHashCode()
 {
     unchecked
     {
         int ParameterTotal = 0;
         foreach (IParameter Parameter in Parameters)
         {
             ParameterTotal += Parameter.GetHashCode();
         }
         if (ParameterTotal > 0)
         {
             return((SQLCommand.GetHashCode() * 23 + CommandType.GetHashCode()) * 23 + ParameterTotal);
         }
         return(SQLCommand.GetHashCode() * 23 + CommandType.GetHashCode());
     }
 }
        /// <summary>
        /// Creates a new instance of EntityClientCacheKey given a entityCommand instance
        /// </summary>
        /// <param name="entityCommand"></param>
        internal EntityClientCacheKey(EntityCommand entityCommand)
        {
            // Command Type
            _commandType = entityCommand.CommandType;

            // Statement
            _eSqlStatement = entityCommand.CommandText;

            // Parameters
            _parametersToken = GetParametersToken(entityCommand);
            _parameterCount = entityCommand.Parameters.Count;

            // Hashcode
            _hashCode = _commandType.GetHashCode() ^
                        _eSqlStatement.GetHashCode() ^
                        _parametersToken.GetHashCode();
        }
        /// <summary>
        ///     Creates a new instance of EntityClientCacheKey given a entityCommand instance
        /// </summary>
        /// <param name="entityCommand"> </param>
        internal EntityClientCacheKey(EntityCommand entityCommand)
        {
            // Command Type
            _commandType = entityCommand.CommandType;

            // Statement
            _eSqlStatement = entityCommand.CommandText;

            // Parameters
            _parametersToken = GetParametersToken(entityCommand);
            _parameterCount  = entityCommand.Parameters.Count;

            // Hashcode
            _hashCode = _commandType.GetHashCode() ^
                        _eSqlStatement.GetHashCode() ^
                        _parametersToken.GetHashCode();
        }
Ejemplo n.º 5
0
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = (CommandName != null
             ? CommandName.GetHashCode()
             : 0);
         hashCode = (hashCode * 397) ^ (CommandType != null
             ? CommandType.GetHashCode()
             : 0);
         hashCode = (hashCode * 397) ^ (ArgumentType != null
             ? ArgumentType.GetHashCode()
             : 0);
         hashCode = (hashCode * 397) ^ (ImplementationType != null
             ? ImplementationType.GetHashCode()
             : 0);
         return(hashCode);
     }
 }
Ejemplo n.º 6
0
 private Identity(string sql, CommandType commandType, string connectionString, Type type, Type parametersType, int gridIndex)
 {
     this.sql              = sql;
     this.commandType      = commandType;
     this.connectionString = connectionString;
     this.type             = type;
     this.parametersType   = parametersType;
     this.gridIndex        = gridIndex;
     unchecked
     {
         hashCode = 17; // we *know* we are using this in a dictionary, so pre-compute this
         hashCode = (hashCode * 23) + commandType.GetHashCode();
         hashCode = (hashCode * 23) + gridIndex.GetHashCode();
         hashCode = (hashCode * 23) + (sql?.GetHashCode() ?? 0);
         hashCode = (hashCode * 23) + (type?.GetHashCode() ?? 0);
         hashCode = (hashCode * 23) + (connectionString == null ? 0 : Identity.ConnectionStringComparer.GetHashCode(connectionString));
         hashCode = (hashCode * 23) + (parametersType?.GetHashCode() ?? 0);
     }
 }
Ejemplo n.º 7
0
 public bool IsSkill()
 {
     return(type.GetHashCode().IsSkill());
 }
Ejemplo n.º 8
0
        /// <summary>
        /// Returns the hash code for the command
        /// </summary>
        /// <returns>The hash code for the object</returns>
        public override int GetHashCode()
        {
            if (InternalHashCode == 0)
            {
                unchecked
                {
                    var ParameterTotal = 0;
                    for (int x = 0, ParametersLength = Parameters.Length; x < ParametersLength; ++x)
                    {
                        ParameterTotal += Parameters[x].GetHashCode();
                    }

                    if (ParameterTotal > 0)
                    {
                        InternalHashCode = (((SQLCommand.GetHashCode(StringComparison.InvariantCultureIgnoreCase) * 23) + CommandType.GetHashCode()) * 23) + ParameterTotal;
                    }
                    InternalHashCode = (SQLCommand.GetHashCode(StringComparison.InvariantCultureIgnoreCase) * 23) + CommandType.GetHashCode();
                }
            }
            return(InternalHashCode);
        }
Ejemplo n.º 9
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (ID != 0L)
            {
                hash ^= ID.GetHashCode();
            }
            if (CommandType != 0)
            {
                hash ^= CommandType.GetHashCode();
            }
            if (MoveDirection != 0)
            {
                hash ^= MoveDirection.GetHashCode();
            }
            if (MoveDuration != 0)
            {
                hash ^= MoveDuration.GetHashCode();
            }
            if (ThrowDistance != 0D)
            {
                hash ^= pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.GetHashCode(ThrowDistance);
            }
            if (ThrowAngle != 0D)
            {
                hash ^= pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.GetHashCode(ThrowAngle);
            }
            if (IsThrowDish != false)
            {
                hash ^= IsThrowDish.GetHashCode();
            }
            if (UseType != 0)
            {
                hash ^= UseType.GetHashCode();
            }
            if (SpeakText.Length != 0)
            {
                hash ^= SpeakText.GetHashCode();
            }
            if (Parameter1 != 0D)
            {
                hash ^= pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.GetHashCode(Parameter1);
            }
            if (Parameter2 != 0D)
            {
                hash ^= pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.GetHashCode(Parameter2);
            }
            if (IsSetTalent != false)
            {
                hash ^= IsSetTalent.GetHashCode();
            }
            if (IsPickSelfPosition != false)
            {
                hash ^= IsPickSelfPosition.GetHashCode();
            }
            if (PickType != 0)
            {
                hash ^= PickType.GetHashCode();
            }
            if (PickDishOrToolType != 0)
            {
                hash ^= PickDishOrToolType.GetHashCode();
            }
            if (Talent != 0)
            {
                hash ^= Talent.GetHashCode();
            }
            if (_unknownFields != null)
            {
                hash ^= _unknownFields.GetHashCode();
            }
            return(hash);
        }
Ejemplo n.º 10
0
 /// <summary>
 /// Returns the hash code for the command
 /// </summary>
 /// <returns>The hash code for the object</returns>
 public override int GetHashCode()
 {
     return((SQLCommand.GetHashCode() + CommandType.GetHashCode()) % Parameters.Sum(x => x.GetHashCode()));
 }