public static NamedExpression CreateFromMemberName(string memberName, Expression innerExpression)
        {
            LinqUtility.CheckNotNull("memberName", memberName);
            LinqUtility.CheckNotNull("innerExpression", innerExpression);

            return(new NamedExpression(memberName, innerExpression));
        }
        public NamedExpression(string name, Expression expression)
        {
            LinqUtility.CheckNotNull("expression", expression);

            _name       = name;
            _expression = expression;
        }
        /// <summary>
        /// Initializes a new instance of <see cref="ArangoQueryProvider"/> using a custom <see cref="IQueryParser"/>.
        /// </summary>
        public ArangoQueryProvider(Type queryableType, IQueryParser queryParser, IQueryExecutor executor, IArangoDatabase db)
            : base(LinqUtility.CheckNotNull("queryParser", queryParser), LinqUtility.CheckNotNull("executor", executor))
        {
            LinqUtility.CheckNotNull("queryableType", queryableType);
            CheckQueryableType(queryableType);

            _queryableType = queryableType;
            this.db        = db;
        }
Exemple #4
0
        public static IEnumerable <MethodInfo> WhereNameMatches(this IEnumerable <MethodInfo> input, string name)
        {
            LinqUtility.CheckNotNull("input", input);
            LinqUtility.CheckNotNullOrEmpty("name", name);

            if (input.Count(mi => mi.Name == name) == 0)
            {
                throw new InvalidOperationException($"No suitable queryable method found for {name}");
            }

            return(input.Where(mi => mi.Name == name));
        }
        public QueryData GetQueryData(Expression expression)
        {
            LinqUtility.CheckNotNull("expression", expression);

            var queryModel = GenerateQueryModel(expression);

            var visitor = new ArangoModelVisitor(db);

            visitor.VisitQueryModel(queryModel);

            visitor.QueryData.Query = visitor.QueryText.ToString();

            return(visitor.QueryData);
        }
        protected override Expression Accept(ExpressionVisitor visitor)
        {
            LinqUtility.CheckNotNull("visitor", visitor);

            var specificVisitor = visitor as INamedExpressionVisitor;

            if (specificVisitor != null)
            {
                return(specificVisitor.VisitNamed(this));
            }
            else
            {
                return(base.Accept(visitor));
            }
        }
        protected override Expression VisitChildren(ExpressionVisitor visitor)
        {
            LinqUtility.CheckNotNull("visitor", visitor);

            var newExpression = visitor.Visit(_expression);

            if (newExpression != _expression)
            {
                return(new NamedExpression(_name, newExpression));
            }
            else
            {
                return(this);
            }
        }
        public static Expression CreateNewExpressionWithNamedArguments(IArangoDatabase db, NewExpression expression)
        {
            LinqUtility.CheckNotNull("expression", expression);

            return(CreateNewExpressionWithNamedArguments(db, expression, expression.Arguments));
        }
Exemple #9
0
        public static IEnumerable <MethodInfo> WithoutEqualityComparer(this IEnumerable <MethodInfo> input)
        {
            LinqUtility.CheckNotNull("input", input);

            return(input.Where(mi => !HasGenericDelegateOfType(mi, typeof(IEqualityComparer <>))));
        }
Exemple #10
0
        public static IEnumerable <MethodInfo> WithoutResultSelector(this IEnumerable <MethodInfo> input)
        {
            LinqUtility.CheckNotNull("input", input);

            return(input.Where(mi => mi.GetParameters().All(p => p.Name != "resultSelector")));
        }
Exemple #11
0
        public static IEnumerable <MethodInfo> WithoutIndexSelector(this IEnumerable <MethodInfo> input, int parameterPosition)
        {
            LinqUtility.CheckNotNull("input", input);

            return(input.Where(mi => !HasIndexSelectorParameter(mi, parameterPosition)));
        }