public IEnumerable <T> ExecuteMany <T>(QueryDescription query, ObjectBinder objectBinder) { //// Check if the container-scoped cache already has results for this exact query in which case return the same //return ContainerScopedCache.GetOrCreateTyped<IEnumerable<T>>( // CacheKey.Create(new HiveQueryCacheKey(query)), // () => // { var totalOutput = new HashSet <T>(); foreach (var reader in _repositoryPool) { reader.ExecuteMany <T>(query, objectBinder) .Cast <IReferenceByHiveId>() .SkipWhile(RepositoryGroupExtensions.SkipAndMergeFromProviders(reader.ProviderMetadata, totalOutput.Cast <IReferenceByHiveId>())) .ForEach(x => totalOutput.Add((T)x)); } var results = totalOutput.Cast <IReferenceByHiveId>().DistinctBy(x => x.Id) .Select(x => RepositoryGroupExtensions.ProcessIdsAndGroupRelationProxyDelegate(_groupRepo, _idRoot, x)) .Cast <T>(); // Raise event with the result of the query FrameworkContext.TaskManager.ExecuteInContext(TaskTriggers.Hive.PostQueryResultsAvailable, this, new TaskEventArgs(FrameworkContext, new HiveQueryResultEventArgs(results, query, ContainerScopedCache))); // Return return(results); //}); }
public IEnumerable <T> ExecuteMany <T>(QueryDescription query, ObjectBinder objectBinder) { //// Check if no criteria was provided, and if we're not doing a skip / take, then throw an exception //// (APN 2012 05 18 temporarily disabled while waiting on impl & config options) //if (query.Criteria == null || query.Criteria is DefaultExpression) //{ // if (!query.ResultFilters.Any(x => x.ResultFilterType == ResultFilterType.Skip || x.ResultFilterType == ResultFilterType.Take || x.ResultFilterType == ResultFilterType.SkipTake)) // { // throw new PaginationRequiredException(); // } //} //// Check if the container-scoped cache already has results for this exact query in which case return the same //return ContainerScopedCache.GetOrCreateTyped<IEnumerable<T>>( // CacheKey.Create(new HiveQueryCacheKey(query)), // () => // { var totalOutput = new HashSet <T>(); foreach (var reader in _repositoryPool) { reader.ExecuteMany <T>(query, objectBinder) .Cast <IReferenceByHiveId>() .SkipWhile(RepositoryGroupExtensions.SkipAndMergeFromProviders(reader.ProviderMetadata, totalOutput.Cast <IReferenceByHiveId>())) .ForEach(x => totalOutput.Add((T)x)); } var results = totalOutput.Cast <IReferenceByHiveId>().DistinctBy(x => x.Id) .Select(x => RepositoryGroupExtensions.ProcessIdsAndGroupRelationProxyDelegate(_groupRepo, _idRoot, x)) .Cast <T>(); // Raise event with the result of the query FrameworkContext.TaskManager.ExecuteInContext(TaskTriggers.Hive.PostQueryResultsAvailable, this, new TaskEventArgs(FrameworkContext, new HiveQueryResultEventArgs(results, query, ContainerScopedCache))); // Return return(results); //}); }