CreateMethodCallOperation() public static method

Generates a new method call operation.
public static CreateMethodCallOperation ( Type type, OperationContext context, MethodCallExpression expression ) : IOperation
type System.Type
context OperationContext
expression System.Linq.Expressions.MethodCallExpression
return IOperation
示例#1
0
        public static IOperation CreateOperation(OperationContext context, MethodCallExpression expression)
        {
            var method = expression.Method.GetGenericMethodDefinition();

            if (method == QueryableAllMethod)
            {
                return(Operation.CreateMethodCallOperation(typeof(AllOperation <>), context, expression, 0));
            }
            if (method == EnumerableAllMethod)
            {
                return(Operation.CreateMethodCallOperation(typeof(AllOperation <>), context, expression, 0));
            }

            throw new NotImplementedException("All operation not found.");
        }
示例#2
0
        public static IOperation CreateOperation(OperationContext context, MethodCallExpression expression)
        {
            var method = expression.Method.GetGenericMethodDefinition();

            if (method.GetGenericArguments().Length == 1 &&
                method.GetParameters().Length == 1)
            {
                return(Operation.CreateMethodCallOperation(typeof(MaxOperation <>), context, expression, 0));
            }
            if (method.GetGenericArguments().Length == 2 &&
                method.GetParameters().Length == 2)
            {
                return(Operation.CreateMethodCallOperation(typeof(MaxWithProjectionOperation <,>), context, expression, 0, 1));
            }

            throw new NotSupportedException("Max operation not found.");
        }
示例#3
0
        public static IOperation CreateOperation(OperationContext context, MethodCallExpression expression)
        {
            var method = expression.Method.GetGenericMethodDefinition();

            if (method.GetGenericArguments().Length == 1 &&
                method.GetParameters().Length == 1)
            {
                return(Operation.CreateMethodCallOperation(typeof(CountOperation <>), context, expression, 0));
            }
            if (method.GetGenericArguments().Length == 1 &&
                method.GetParameters().Length == 2)
            {
                return(Operation.CreateMethodCallOperation(typeof(CountOperationWithPredicate <>), context, expression, 0));
            }

            throw new NotImplementedException("Count operation not found.");
        }
示例#4
0
        public static IOperation CreateOperation(OperationContext context, MethodCallExpression expression)
        {
            if (expression.Method.DeclaringType != typeof(Enumerable) &&
                expression.Method.DeclaringType != typeof(Queryable))
            {
                throw new InvalidOperationException("Requires Enumerable or Queryable method.");
            }

            var method = expression.Method.GetGenericMethodDefinition();

            if (method.GetGenericArguments().Length == 1 &&
                method.GetParameters().Length == 1)
            {
                return(Operation.CreateMethodCallOperation(typeof(CastOperation <>), context, expression, 0));
            }

            throw new NotSupportedException("Cast operation not found.");
        }
示例#5
0
 public static IOperation CreateOperation(OperationContext context, MethodCallExpression expression)
 {
     return(Operation.CreateMethodCallOperation(typeof(DefaultIfEmptyOperation <>), context, expression, 0));
 }
示例#6
0
 public static IOperation CreateOperation(OperationContext context, MethodCallExpression expression)
 {
     return(Operation.CreateMethodCallOperation(typeof(OrderByOperation <,>), context, expression, 0, 1));
 }