/// <summary>
        ///     Returns the computer to use for the relational operation based on the coercion type.
        /// </summary>
        /// <param name="value">the relational op value (this)</param>
        /// <param name="coercedType">is the object type</param>
        /// <param name="typeOne">the compare-to type on the LHS</param>
        /// <param name="typeTwo">the compare-to type on the RHS</param>
        /// <returns>computer for performing the relational op</returns>
        public static RelationalOpEnumComputer GetComputer(
            this RelationalOpEnum value,
            Type coercedType,
            Type typeOne,
            Type typeTwo)
        {
            coercedType = coercedType.GetBoxedType();
            if (coercedType != typeof(double?) &&
                coercedType != typeof(float?) &&
                coercedType != typeof(int?) &&
                coercedType != typeof(long?) &&
                coercedType != typeof(string) &&
                coercedType != typeof(decimal?) &&
                coercedType != typeof(BigInteger?))
            {
                throw new ArgumentException("Unsupported type for relational op compare, type " + coercedType);
            }

            if (coercedType.IsBigInteger())
            {
                return(MakeBigIntegerComputer(value, typeOne, typeTwo));
            }

            var key = new RelationalOpDesc(coercedType, value);

            return(computers.Get(key));
        }
Exemple #2
0
 protected bool Equals(RelationalOpDesc other)
 {
     return(Equals(_type, other._type) && _op == other._op);
 }