Ejemplo n.º 1
0
        IDictionary <CompositionContract, ICollection <PrimitiveExport> > MapPrimitiveParts(ComposablePartCatalog catalog, Func <string, Type> typeNameResolver, Func <CreationPolicy, Tuple <bool, string> > creationPolicyMapping)
        {
            var result = new Dictionary <CompositionContract, ICollection <PrimitiveExport> >();

            foreach (var part in catalog)
            {
                var primitivePart = new PrimitivePart(part, typeNameResolver, creationPolicyMapping);
                foreach (var export in part.ExportDefinitions)
                {
                    var contract = MapExportedContract(export, typeNameResolver);
                    ICollection <PrimitiveExport> existing;
                    if (!result.TryGetValue(contract, out existing))
                    {
                        existing = new List <PrimitiveExport>();
                        result.Add(contract, existing);
                    }
                    existing.Add(new PrimitiveExport(export, primitivePart));
                }
            }

            return(result);
        }
Ejemplo n.º 2
0
 public PrimitiveExport(ExportDefinition export, PrimitivePart part)
 {
     _export = export;
     _part   = part;
 }