Exemple #1
0
        private ImmutableList <Product> ExecuteNestedPipeline(ImmutableList <FactReference> startReferences, Pipeline pipeline, Projection projection)
        {
            var subset = Subset.FromPipeline(pipeline);
            var namedSpecifications = projection.GetNamedSpecifications();
            var products            = (
                from startReference in startReferences
                from product in ExecutePipeline(startReference, pipeline)
                select product).ToImmutableList();
            var collections =
                from namedSpecification in namedSpecifications
                let name = namedSpecification.name
                           let childPipeline = pipeline.Compose(namedSpecification.specification.Pipeline)
                                               let childProducts = ExecuteNestedPipeline(startReferences, childPipeline, namedSpecification.specification.Projection)
                                                                   select(name, childProducts);
            var mergedProducts = collections
                                 .Aggregate(products, (source, collection) => MergeProducts(subset, collection.name, collection.childProducts, source));

            return(mergedProducts);
        }