Beispiel #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="RavenQueryProvider{T}"/> class.
        /// </summary>
        public RavenQueryProvider(
            IDocumentQueryGenerator queryGenerator,
            string indexName,
            RavenQueryStatistics ravenQueryStatistics,
            RavenQueryHighlightings highlightings
#if !SILVERLIGHT
            , IDatabaseCommands databaseCommands
#endif
            , IAsyncDatabaseCommands asyncDatabaseCommands,
            bool isMapReduce
            )
        {
            FieldsToFetch  = new HashSet <string>();
            FieldsToRename = new List <RenamedField>();

            this.queryGenerator       = queryGenerator;
            this.indexName            = indexName;
            this.ravenQueryStatistics = ravenQueryStatistics;
            this.highlightings        = highlightings;
#if !SILVERLIGHT
            this.databaseCommands = databaseCommands;
#endif
            this.asyncDatabaseCommands = asyncDatabaseCommands;
            this.isMapReduce           = isMapReduce;
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="RavenQueryInspector{T}"/> class.
        /// </summary>
        public RavenQueryInspector(
            IRavenQueryProvider provider,
            RavenQueryStatistics queryStats,
            RavenQueryHighlightings highlightings,
            string indexName,
            Expression expression,
            InMemoryDocumentSessionOperations session
#if !SILVERLIGHT
            , IDatabaseCommands databaseCommands
#endif
            , IAsyncDatabaseCommands asyncDatabaseCommands,
            bool isMapReduce
            )
        {
            if (provider == null)
            {
                throw new ArgumentNullException("provider");
            }
            this.provider      = provider.For <T>();
            this.queryStats    = queryStats;
            this.highlightings = highlightings;
            this.indexName     = indexName;
            this.session       = session;
#if !SILVERLIGHT
            this.databaseCommands = databaseCommands;
#endif
            this.asyncDatabaseCommands = asyncDatabaseCommands;
            this.isMapReduce           = isMapReduce;
            this.provider.AfterQueryExecuted(this.AfterQueryExecuted);
            this.expression = expression ?? Expression.Constant(this);
        }
Beispiel #3
0
        /// <summary>
        /// Queries the specified index using Linq.
        /// </summary>
        /// <typeparam name="T">The result of the query</typeparam>
        /// <param name="indexName">Name of the index.</param>
        /// <param name="isMapReduce">Whatever we are querying a map/reduce index (modify how we treat identifier properties)</param>
        public IRavenQueryable <T> Query <T>(string indexName, bool isMapReduce = false)
        {
            var ravenQueryStatistics = new RavenQueryStatistics();
            var highlightings        = new RavenQueryHighlightings();
            var ravenQueryProvider   = new RavenQueryProvider <T>(this, indexName, ravenQueryStatistics, highlightings, DatabaseCommands, null, isMapReduce);

            return(new RavenQueryInspector <T>(ravenQueryProvider, ravenQueryStatistics, highlightings, indexName, null, this, DatabaseCommands, null, isMapReduce));
        }
Beispiel #4
0
        /// <summary>
        /// Queries the specified index using Linq.
        /// </summary>
        /// <typeparam name="T">The result of the query</typeparam>
        /// <param name="indexName">Name of the index.</param>
        /// <param name="isMapReduce">Whatever we are querying a map/reduce index (modify how we treat identifier properties)</param>
        public IRavenQueryable <T> Query <T>(string indexName, bool isMapReduce = false)
        {
            var ravenQueryStatistics = new RavenQueryStatistics();
            var highlightings        = new RavenQueryHighlightings();
            var provider             = new RavenQueryProvider <T>(this, indexName, ravenQueryStatistics, highlightings, null, null, isMapReduce);

            return(CreateRavenQueryInspector(indexName, isMapReduce, provider, ravenQueryStatistics, highlightings));
        }
Beispiel #5
0
 protected override RavenQueryInspector <T> CreateRavenQueryInspector <T>(string indexName, bool isMapReduce, RavenQueryProvider <T> provider,
                                                                          RavenQueryStatistics ravenQueryStatistics,
                                                                          RavenQueryHighlightings highlightings)
 {
     return(new ShardedRavenQueryInspector <T>(provider, ravenQueryStatistics, highlightings, indexName, null, this, isMapReduce, shardStrategy,
                                               null,
                                               shardDbCommands.Values.ToList()));
 }
 public ShardedRavenQueryInspector(IRavenQueryProvider provider,
                                   RavenQueryStatistics queryStats, RavenQueryHighlightings highlightings, string indexName, Expression expression, InMemoryDocumentSessionOperations session, bool isMapReduce,
                                   ShardStrategy shardStrategy,
                                   List <IDatabaseCommands> shardDbCommands,
                                   List <IAsyncDatabaseCommands> asyncShardDbCommands)
     : base(provider, queryStats, highlightings, indexName, expression, session,
            null,
            null,
            isMapReduce)
 {
     this.shardStrategy        = shardStrategy;
     this.shardDbCommands      = shardDbCommands;
     this.asyncShardDbCommands = asyncShardDbCommands;
 }
        private IRavenQueryable <T> QueryInternal <T>(IAsyncDatabaseCommands assyncDatabaseCommands, string indexName, bool isMapReduce = false)
        {
            var ravenQueryStatistics = new RavenQueryStatistics();
            var highlightings        = new RavenQueryHighlightings();
            var ravenQueryInspector  = new RavenQueryInspector <T>();
            var ravenQueryProvider   = new RavenQueryProvider <T>(this, indexName, ravenQueryStatistics, highlightings, null, assyncDatabaseCommands, isMapReduce);

            ravenQueryInspector.Init(ravenQueryProvider,
                                     ravenQueryStatistics,
                                     highlightings,
                                     indexName,
                                     null,
                                     this, null, assyncDatabaseCommands, isMapReduce);
            return(ravenQueryInspector);
        }
Beispiel #8
0
        /// <summary>
        /// Initializes a new instance of the <see cref="RavenQueryProvider{T}"/> class.
        /// </summary>
        public RavenQueryProvider(
            IDocumentQueryGenerator queryGenerator,
            string indexName,
            RavenQueryStatistics ravenQueryStatistics,
            RavenQueryHighlightings highlightings
            ,
            bool isMapReduce
            )
        {
            FieldsToFetch  = new HashSet <string>();
            FieldsToRename = new List <RenamedField>();

            this.queryGenerator       = queryGenerator;
            this.indexName            = indexName;
            this.ravenQueryStatistics = ravenQueryStatistics;
            this.highlightings        = highlightings;
            this.isMapReduce          = isMapReduce;
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="RavenQueryInspector{T}"/> class.
 /// </summary>
 public void Init(
     IRavenQueryProvider provider,
     RavenQueryStatistics queryStats,
     RavenQueryHighlightings highlightings,
     string indexName,
     Expression expression,
     InMemoryDocumentSessionOperations session
     ,
     bool isMapReduce
     )
 {
     if (provider == null)
     {
         throw new ArgumentNullException("provider");
     }
     this.provider      = provider.For <T>();
     this.queryStats    = queryStats;
     this.highlightings = highlightings;
     this.indexName     = indexName;
     this.session       = session;
     this.isMapReduce   = isMapReduce;
     this.provider.AfterQueryExecuted(this.AfterQueryExecuted);
     this.expression = expression ?? Expression.Constant(this);
 }
Beispiel #10
0
 protected abstract RavenQueryInspector <T> CreateRavenQueryInspector <T>(string indexName, bool isMapReduce,
                                                                          RavenQueryProvider <T> provider,
                                                                          RavenQueryStatistics
                                                                          ravenQueryStatistics,
                                                                          RavenQueryHighlightings highlightings);