Exemple #1
0
        public static Func <T, int> Hashing <T>(this IHashingExpression <T> hashing)
        {
            if (hashing == null)
            {
                throw new NullReferenceException();
            }

            return(hashing.Expression.Compile());
        }
Exemple #2
0
        public static IHashingExpression <T> Hash <T, K>(this IHashingExpression <T> expression, Expression <Func <T, K> > selector)
        {
            if (expression == null)
            {
                throw new NullReferenceException();
            }
            if (selector == null)
            {
                throw new ArgumentNullException("selector");
            }

            return(new HashingExpressionImpl <T>(HashCore(expression.Expression, expression.Composer, selector, DefaultHashing <K>()), expression.Composer));
        }
Exemple #3
0
        public static IHashingExpression <T> NullableHash <T, K>(this IHashingExpression <T> expression, Expression <Func <T, K?> > selector, Expression <Func <K, int> > hashing)
            where K : struct
        {
            if (expression == null)
            {
                throw new NullReferenceException();
            }
            if (selector == null)
            {
                throw new ArgumentNullException("selector");
            }
            if (hashing == null)
            {
                throw new ArgumentNullException("hashing");
            }

            return(new HashingExpressionImpl <T>(HashCore(expression.Expression, expression.Composer, selector, NullableHashing <K>(hashing)), expression.Composer));
        }
Exemple #4
0
        public static IHashingExpression <T> NullableHash <T, K>(this IHashingExpression <T> expression, Expression <Func <T, K?> > selector, IEqualityComparer <K> equalityComparer)
            where K : struct
        {
            if (expression == null)
            {
                throw new NullReferenceException();
            }
            if (selector == null)
            {
                throw new ArgumentNullException("selector");
            }
            if (equalityComparer == null)
            {
                throw new ArgumentNullException("equalityComparer");
            }

            return(new HashingExpressionImpl <T>(HashCore(expression.Expression, expression.Composer, selector, NullableHashing <K>(ComparerHashing <K>(equalityComparer))), expression.Composer));
        }
Exemple #5
0
        public static IEqualityComparer <T> EqualityComparer <T>(this IEqualityExpression <T> equality, IHashingExpression <T> hashing)
        {
            if (equality == null)
            {
                throw new NullReferenceException();
            }
            if (hashing == null)
            {
                throw new ArgumentNullException("hashing");
            }

            return(new CustomEqualityComparer <T>(equality.Expression.Compile(), hashing.Expression.Compile()));
        }