System\ComponentModel\Composition\Hosting\CatalogExportProvider.cs (29)
39private readonly Dictionary<ComposablePartDefinition, CatalogPart> _activatedParts = new Dictionary<ComposablePartDefinition, CatalogPart>();
40private readonly HashSet<ComposablePartDefinition> _rejectedParts = new HashSet<ComposablePartDefinition>();
343private Export CreateExport(ComposablePartDefinition partDefinition, ExportDefinition exportDefinition, bool isExportFactory, CreationPolicy importPolicy)
365private static ExportDefinition[] GetExportsFromPartDefinitions(IEnumerable<ComposablePartDefinition> partDefinitions)
369foreach (var partDefinition in partDefinitions)
402foreach (var definition in e.RemovedDefinitions)
414var capturedDefinition = definition;
438private CatalogPart GetComposablePart(ComposablePartDefinition partDefinition, bool isSharedPart)
466private CatalogPart GetSharedPart(ComposablePartDefinition partDefinition)
642private bool IsRejected(ComposablePartDefinition definition, AtomicComposition? atomicComposition)
698private bool DetermineRejection(ComposablePartDefinition definition, AtomicComposition? parentAtomicComposition)
790var affectedRejections = new HashSet<ComposablePartDefinition>();
792ComposablePartDefinition[] rejectedParts;
797foreach (var definition in rejectedParts)
820foreach (var partDefinition in affectedRejections)
830var capturedPartDefinition = partDefinition;
909private AtomicCompositionQueryState QueryPartState(AtomicComposition atomicComposition, ComposablePartDefinition definition)
930ComposablePartDefinition part,
939HashSet<ComposablePartDefinition> hashset,
965protected abstract bool IsMatchingDefinition(ComposablePartDefinition part, int partHashCode);
967public AtomicCompositionQueryState GetQueryState(ComposablePartDefinition definition)
987private readonly ComposablePartDefinition _part;
989public PartEqualsQueryStateNode(ComposablePartDefinition part, PartQueryStateNode? previousNode, AtomicCompositionQueryState state) :
996protected override bool IsMatchingDefinition(ComposablePartDefinition part, int partHashCode)
1008private readonly HashSet<ComposablePartDefinition> _parts;
1009public PartInHashSetQueryStateNode(HashSet<ComposablePartDefinition> parts, PartQueryStateNode? previousNode, AtomicCompositionQueryState state) :
1015protected override bool IsMatchingDefinition(ComposablePartDefinition part, int partHashCode)
System\ComponentModel\Composition\Hosting\TypeCatalog.cs (21)
29private volatile List<ComposablePartDefinition>? _parts;
32private readonly Lazy<Dictionary<string, List<ComposablePartDefinition>>> _contractPartIndex;
81_contractPartIndex = new Lazy<Dictionary<string, List<ComposablePartDefinition>>>(CreateIndex, true);
109_contractPartIndex = new Lazy<Dictionary<string, List<ComposablePartDefinition>>>(CreateIndex, true);
138_contractPartIndex = new Lazy<Dictionary<string, List<ComposablePartDefinition>>>(CreateIndex, true);
171_contractPartIndex = new Lazy<Dictionary<string, List<ComposablePartDefinition>>>(CreateIndex, true);
223public override IEnumerator<ComposablePartDefinition> GetEnumerator()
251private IEnumerable<ComposablePartDefinition> PartsInternal
266var collection = new List<ComposablePartDefinition>();
269var definition = AttributedModelDiscovery.CreatePartDefinitionIfDiscoverable(type, _definitionOrigin);
287internal override IEnumerable<ComposablePartDefinition>? GetCandidateParts(ImportDefinition definition)
299List<ComposablePartDefinition>? nonGenericMatches = GetCandidateParts(contractName);
300List<ComposablePartDefinition>? genericMatches = GetCandidateParts(genericContractName);
305private List<ComposablePartDefinition>? GetCandidateParts(string? contractName)
312_contractPartIndex.Value.TryGetValue(contractName, out List<ComposablePartDefinition>? contractCandidateParts);
316private Dictionary<string, List<ComposablePartDefinition>> CreateIndex()
318Dictionary<string, List<ComposablePartDefinition>> index = new Dictionary<string, List<ComposablePartDefinition>>(StringComparers.ContractName);
320foreach (var part in PartsInternal)
324List<ComposablePartDefinition>? contractParts = null;
327contractParts = new List<ComposablePartDefinition>();
System\ComponentModel\Composition\Primitives\ComposablePartDefinition.cs (17)
16internal static readonly IEnumerable<Tuple<ComposablePartDefinition, ExportDefinition>> _EmptyExports = Enumerable.Empty<Tuple<ComposablePartDefinition, ExportDefinition>>();
19/// Initializes a new instance of the <see cref="ComposablePartDefinition"/> class.
32/// <see cref="ComposablePartDefinition"/>.
38/// <see cref="ComposablePartDefinition"/> do not provide exported values, return
51/// <see cref="ComposablePartDefinition"/>.
57/// <see cref="ComposablePartDefinition"/> do not have imports, return an empty
68/// <see cref="ComposablePartDefinition"/>. The default is an empty, read-only
78/// <see cref="ComposablePartDefinition"/> does contain metadata,
105internal virtual bool TryGetExports(ImportDefinition definition, out Tuple<ComposablePartDefinition, ExportDefinition>? singleMatch, out IEnumerable<Tuple<ComposablePartDefinition, ExportDefinition>>? multipleMatches)
110List<Tuple<ComposablePartDefinition, ExportDefinition>>? multipleExports = null;
111Tuple<ComposablePartDefinition, ExportDefinition>? singleExport = null;
120singleExport = new Tuple<ComposablePartDefinition, ExportDefinition>(this, export);
126multipleExports = new List<Tuple<ComposablePartDefinition, ExportDefinition>>();
129multipleExports.Add(new Tuple<ComposablePartDefinition, ExportDefinition>(this, export));
150internal virtual ComposablePartDefinition? GetGenericPartDefinition()
System\ComponentModel\Composition\ReflectionModel\ReflectionComposablePartDefinition.cs (18)
131internal override ComposablePartDefinition? GetGenericPartDefinition()
141internal override bool TryGetExports(ImportDefinition definition, out Tuple<ComposablePartDefinition, ExportDefinition>? singleMatch, out IEnumerable<Tuple<ComposablePartDefinition, ExportDefinition>>? multipleMatches)
148List<Tuple<ComposablePartDefinition, ExportDefinition>>? exports = null;
157HashSet<ComposablePartDefinition>? candidates = null;
158ComposablePartDefinition? previousPart = null;
163if (TryMakeGenericPartDefinition(candidateParameters, out ComposablePartDefinition? candidatePart))
176candidates = new HashSet<ComposablePartDefinition>();
192if (candidatePart.TryGetExports(definition, out Tuple<ComposablePartDefinition, ExportDefinition>? candidateSingleMatch, out IEnumerable<Tuple<ComposablePartDefinition, ExportDefinition>>? candidateMultipleMatches))
218private bool TryGetNonGenericExports(ImportDefinition definition, out Tuple<ComposablePartDefinition, ExportDefinition>? singleMatch, out IEnumerable<Tuple<ComposablePartDefinition, ExportDefinition>>? multipleMatches)
223List<Tuple<ComposablePartDefinition, ExportDefinition>>? multipleExports = null;
224Tuple<ComposablePartDefinition, ExportDefinition>? singleExport = null;
234singleExport = new Tuple<ComposablePartDefinition, ExportDefinition>(this, export);
240multipleExports = new List<Tuple<ComposablePartDefinition, ExportDefinition>>();
243multipleExports.Add(new Tuple<ComposablePartDefinition, ExportDefinition>(this, export));
297internal bool TryMakeGenericPartDefinition(Type[] genericTypeParameters, [NotNullWhen(true)] out ComposablePartDefinition? genericPartDefinition)