public IRavenQueryable <T> Query <T>(string indexName = null, string collectionName = null, bool isMapReduce = false)
        {
            var type = typeof(T);

            (indexName, collectionName) = ProcessQueryParameters(type, indexName, collectionName, Conventions);

            var queryStatistics = new QueryStatistics();
            var highlightings   = new LinqQueryHighlightings();

            var ravenQueryInspector = new RavenQueryInspector <T>();
            var ravenQueryProvider  = new RavenQueryProvider <T>(
                this,
                indexName,
                collectionName,
                type,
                queryStatistics,
                highlightings,
                isMapReduce,
                Conventions);

            ravenQueryInspector.Init(ravenQueryProvider,
                                     queryStatistics,
                                     highlightings,
                                     indexName,
                                     collectionName,
                                     null,
                                     this,
                                     isMapReduce);

            return(ravenQueryInspector);
        }
Пример #2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="RavenQueryInspector{T}"/> class.
 /// </summary>
 public void Init(
     IRavenQueryProvider provider,
     QueryStatistics queryStats,
     LinqQueryHighlightings highlightings,
     string indexName,
     string collectionName,
     Expression expression,
     InMemoryDocumentSessionOperations session,
     bool isMapReduce)
 {
     _conventions    = session.Conventions;
     _provider       = provider?.For <T>() ?? throw new ArgumentNullException(nameof(provider));
     _queryStats     = queryStats;
     _highlightings  = highlightings;
     _indexName      = indexName;
     _collectionName = collectionName;
     _session        = session;
     _isMapReduce    = isMapReduce;
     _provider.AfterQueryExecuted(AfterQueryExecuted);
     _expression = expression ?? Expression.Constant(this);
 }