Exemplo n.º 1
0
        /// <exception cref="NotSupportedException" />
        /// <exception cref="InvalidOperationException" />
        private IEnumerable <T> FilterComparsion(
            Expression memberExpression, Expression keyExpression, ExpressionType type)
        {
            IComparsionIndex <T> index = FindComparsionIndex(memberExpression);

            object key = keyExpression.GetValue();

            switch (type)
            {
            case ExpressionType.GreaterThan:
                return(index.GreaterThan(key, exclusive: true));

            case ExpressionType.GreaterThanOrEqual:
                return(index.GreaterThan(key, exclusive: false));

            case ExpressionType.LessThan:
                return(index.LessThan(key, exclusive: true));

            case ExpressionType.LessThanOrEqual:
                return(index.LessThan(key, exclusive: false));

            default:
                throw new NotSupportedException($"Expression {type} should be Comparsion");
            }
        }