Ejemplo n.º 1
0
        public ComposableCatalog AddParts(DiscoveredParts parts)
        {
            Requires.NotNull(parts, nameof(parts));

            var catalog = this.AddParts(parts.Parts);

            return(new ComposableCatalog(catalog.parts, catalog.exportsByContract, catalog.typesBackingParts, catalog.DiscoveredParts.Merge(parts), catalog.Resolver));
        }
Ejemplo n.º 2
0
        internal DiscoveredParts Merge(DiscoveredParts other)
        {
            Requires.NotNull(other, nameof(other));

            if (other.Parts.Count == 0 && other.DiscoveryErrors.Count == 0)
            {
                return(this);
            }

            return(new DiscoveredParts(this.Parts.Union(other.Parts), this.DiscoveryErrors.AddRange(other.DiscoveryErrors)));
        }
Ejemplo n.º 3
0
        private ComposableCatalog(ImmutableHashSet <ComposablePartDefinition> parts, ImmutableDictionary <string, ImmutableList <ExportDefinitionBinding> > exportsByContract, ImmutableHashSet <TypeRef> typesBackingParts, DiscoveredParts discoveredParts, Resolver resolver)
        {
            Requires.NotNull(parts, nameof(parts));
            Requires.NotNull(exportsByContract, nameof(exportsByContract));
            Requires.NotNull(typesBackingParts, nameof(typesBackingParts));
            Requires.NotNull(discoveredParts, nameof(discoveredParts));
            Requires.NotNull(resolver, nameof(resolver));

            this.parts             = parts;
            this.exportsByContract = exportsByContract;
            this.typesBackingParts = typesBackingParts;
            this.DiscoveredParts   = discoveredParts;
            this.Resolver          = resolver;
        }