/// <inheritdoc cref="IQueryBatchItem.ProcessResults" />
        public async Task ProcessResultsAsync(CancellationToken cancellationToken)
        {
            cancellationToken.ThrowIfCancellationRequested();
            ThrowIfNotInitialized();

            using (Session.SwitchCacheMode(_cacheMode))
                await(InitializeEntitiesAndCollectionsAsync(_reader, _hydratedObjects, cancellationToken)).ConfigureAwait(false);

            for (var i = 0; i < _queryInfos.Count; i++)
            {
                var queryInfo = _queryInfos[i];
                if (_subselectResultKeys[i] != null)
                {
                    queryInfo.Loader.CreateSubselects(_subselectResultKeys[i], queryInfo.Parameters, Session);
                }

                if (queryInfo.IsCacheable)
                {
                    if (queryInfo.IsResultFromCache)
                    {
                        var queryCacheBuilder = new QueryCacheResultBuilder(queryInfo.Loader);
                        queryInfo.Result = queryCacheBuilder.GetResultList(queryInfo.Result);
                    }

                    // This transformation must not be applied to ResultToCache.
                    queryInfo.Result =
                        queryInfo.Loader.TransformCacheableResults(
                            queryInfo.Parameters, queryInfo.CacheKey.ResultTransformer, queryInfo.Result);
                }
            }
            AfterLoadCallback?.Invoke(GetResults());
        }
        /// <inheritdoc cref="IQueryBatchItem.ProcessResults" />
        public void ProcessResults()
        {
            ThrowIfNotInitialized();

            using (Session.SwitchCacheMode(_cacheMode))
                InitializeEntitiesAndCollections(_reader, _hydratedObjects);

            for (var i = 0; i < _queryInfos.Count; i++)
            {
                var queryInfo = _queryInfos[i];
                if (_subselectResultKeys[i] != null)
                {
                    queryInfo.Loader.CreateSubselects(_subselectResultKeys[i], queryInfo.Parameters, Session);
                }

                if (queryInfo.IsCacheable)
                {
                    if (queryInfo.IsResultFromCache)
                    {
                        var queryCacheBuilder = new QueryCacheResultBuilder(queryInfo.Loader);
                        queryInfo.Result = queryCacheBuilder.GetResultList(queryInfo.Result);
                    }

                    // This transformation must not be applied to ResultToCache.
                    queryInfo.Result =
                        queryInfo.Loader.TransformCacheableResults(
                            queryInfo.Parameters, queryInfo.CacheKey.ResultTransformer, queryInfo.Result);
                }
            }
            AfterLoadCallback?.Invoke(GetResults());
        }
        public void ProcessResults()
        {
            for (int i = 0; i < _queryInfos.Count; i++)
            {
                var queryInfo = _queryInfos[i];
                if (_subselectResultKeys[i] != null)
                {
                    queryInfo.Loader.CreateSubselects(_subselectResultKeys[i], queryInfo.Parameters, Session);
                }

                // Handle cache if cacheable.
                if (queryInfo.Cache != null)
                {
                    queryInfo.Loader.PutResultInQueryCache(Session, queryInfo.Parameters, queryInfo.Cache, queryInfo.CacheKey, _loaderResults[i]);
                }
            }
            AfterLoadCallback?.Invoke(GetResults());
        }
        public async Task ProcessResultsAsync(CancellationToken cancellationToken)
        {
            cancellationToken.ThrowIfCancellationRequested();
            for (int i = 0; i < _queryInfos.Count; i++)
            {
                var queryInfo = _queryInfos[i];
                if (_subselectResultKeys[i] != null)
                {
                    queryInfo.Loader.CreateSubselects(_subselectResultKeys[i], queryInfo.Parameters, Session);
                }

                // Handle cache if cacheable.
                if (queryInfo.Cache != null)
                {
                    await(queryInfo.Loader.PutResultInQueryCacheAsync(Session, queryInfo.Parameters, queryInfo.Cache, queryInfo.CacheKey, _loaderResults[i], cancellationToken)).ConfigureAwait(false);
                }
            }
            AfterLoadCallback?.Invoke(GetResults());
        }
        /// <inheritdoc />
        public void ProcessResults()
        {
            ThrowIfNotInitialized();

            for (var i = 0; i < _queryInfos.Count; i++)
            {
                var queryInfo = _queryInfos[i];
                if (_subselectResultKeys[i] != null)
                {
                    queryInfo.Loader.CreateSubselects(_subselectResultKeys[i], queryInfo.Parameters, Session);
                }

                if (queryInfo.IsCacheable)
                {
                    // This transformation must not be applied to ResultToCache.
                    queryInfo.Result =
                        queryInfo.Loader.TransformCacheableResults(
                            queryInfo.Parameters, queryInfo.CacheKey.ResultTransformer, queryInfo.Result);
                }
            }
            AfterLoadCallback?.Invoke(GetResults());
        }
 public async Task ExecuteNonBatchedAsync(CancellationToken cancellationToken)
 {
     cancellationToken.ThrowIfCancellationRequested();
     _finalResults = await(GetResultsNonBatchedAsync(cancellationToken)).ConfigureAwait(false);
     AfterLoadCallback?.Invoke(_finalResults);
 }
 /// <inheritdoc />
 public void ExecuteNonBatched()
 {
     _finalResults = GetResultsNonBatched();
     AfterLoadCallback?.Invoke(_finalResults);
 }