Пример #1
0
        /// <summary>
        /// This constructor is called by the client to create the data source.
        /// </summary>
        public QueryableNeo4jStatement(IStatementRunner runner, Func <Statement> statement, Func <IRecord, Type, object> mapper)
        {
            Runner    = runner ?? throw new ArgumentNullException(nameof(runner));
            Statement = statement ?? throw new ArgumentNullException(nameof(statement));
            Mapper    = mapper ?? throw new ArgumentNullException(nameof(mapper));

            Provider   = new CypherQueryProvider(runner, statement, mapper);
            Expression = Expression.Constant(this);
        }
Пример #2
0
        /// <summary>
        /// This constructor is called by Provider.CreateQuery().
        /// </summary>
        /// <param name="expression"></param>
        public QueryableNeo4jStatement(IStatementRunner runner, Func <Statement> statement, Func <IRecord, Type, object> mapper, CypherQueryProvider provider, Expression expression)
            : this(runner, statement, mapper)
        {
            provider   = provider ?? throw new ArgumentNullException(nameof(provider));
            expression = expression ?? throw new ArgumentNullException(nameof(expression));

            if (!typeof(IQueryable <TData>).IsAssignableFrom(expression.Type))
            {
                throw new ArgumentOutOfRangeException(nameof(expression));
            }

            Provider   = provider;
            Expression = expression;
        }