Пример #1
0
        public async Task <IAsyncEnumerator <StreamResult <T> > > StreamAsync <T>(IAsyncDocumentQuery <T> query, Reference <QueryHeaderInformation> queryHeaderInformation)
        {
            var ravenQueryInspector = ((IRavenQueryInspector)query);
            var indexQuery          = ravenQueryInspector.GetIndexQuery(true);
            var enumerator          = await AsyncDatabaseCommands.StreamQueryAsync(ravenQueryInspector.AsyncIndexQueried, indexQuery, queryHeaderInformation);

            var queryOperation = ((AsyncDocumentQuery <T>)query).InitializeQueryOperation(null);

            queryOperation.DisableEntitiesTracking = true;

            return(new QueryYieldStream <T>(this, enumerator, queryOperation));
        }
Пример #2
0
        public async Task <IAsyncEnumerator <StreamResult <T> > > StreamAsync <T>(IAsyncDocumentQuery <T> query, Reference <QueryHeaderInformation> queryHeaderInformation)
        {
            var ravenQueryInspector = ((IRavenQueryInspector)query);
            var indexQuery          = ravenQueryInspector.GetIndexQuery(true);

            if (indexQuery.WaitForNonStaleResults || indexQuery.WaitForNonStaleResultsAsOfNow)
            {
                throw new NotSupportedException(
                          "Since Stream() does not wait for indexing (by design), streaming query with WaitForNonStaleResults is not supported.");
            }


            var enumerator = await AsyncDatabaseCommands.StreamQueryAsync(ravenQueryInspector.AsyncIndexQueried, indexQuery, queryHeaderInformation).ConfigureAwait(false);

            var queryOperation = ((AsyncDocumentQuery <T>)query).InitializeQueryOperation(null);

            queryOperation.DisableEntitiesTracking = true;

            return(new QueryYieldStream <T>(this, enumerator, queryOperation));
        }