Пример #1
0
        ///<inheritdoc/>
        public IReadOnlyDictionary <TAggregate, int> ReadIndex <T, TAggregate>(Expression <Func <T, TAggregate> > fieldExpression)
        {
            var provider = new ElasticQueryProvider(Connection, Mapping, Log, RetryPolicy);
            var data     = provider.ExecuteIndex(fieldExpression);

            return(data);
        }
Пример #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ElasticQuery{T}"/> class.
        /// </summary>
        /// <param name="provider">The <see cref="ElasticQueryProvider"/> used to execute the queries.</param>
        public ElasticQuery(ElasticQueryProvider provider)
        {
            Argument.EnsureNotNull(nameof(provider), provider);

            this.provider = provider;
            Expression    = Expression.Constant(this);
        }
Пример #3
0
        /// <inheritdoc/>
        public virtual IQueryable <T> Query <T>()
        {
            var prefix   = Mapping.GetDocumentMappingPrefix(typeof(T));
            var provider = new ElasticQueryProvider(Connection, Mapping, Log, RetryPolicy, prefix);

            return(new ElasticQuery <T>(provider));
        }
Пример #4
0
        /// <summary>
        /// Initializes a new instance of this class.
        /// </summary>
        /// <param name="provider">The <see cref="ElasticQueryProvider"/> used to execute the queries.</param>
        /// <param name="expression">The <see cref="Expression"/> that represents the LINQ query so far.</param>
        public ElasticQuery(ElasticQueryProvider provider, Expression expression)
        {
            Argument.EnsureNotNull(nameof(provider), provider);
            Argument.EnsureNotNull(nameof(expression), expression);

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

            this.provider = provider;
            Expression    = expression;
        }