static IEnumerable <Export> ResolveExports(this IComponentContext context, ContractBasedImportDefinition cbid) { var componentsForContract = context.ComponentsForContract(cbid); var exportsForContract = componentsForContract .Select(cpt => context.ResolveComponent(cpt, Enumerable.Empty <Parameter>())) .Cast <Export>() .ToList(); return(exportsForContract); }
private static IEnumerable <Export> ResolveExports(this IComponentContext context, ContractBasedImportDefinition cbid) { var contractService = new ContractBasedService(cbid.ContractName, cbid.RequiredTypeIdentity); var componentsForContract = context.ComponentsForContract(cbid, contractService); var exportsForContract = componentsForContract .Select(cpt => context.ResolveComponent(new ResolveRequest(contractService, cpt, Enumerable.Empty <Parameter>()))) .Cast <Export>() .ToList(); return(exportsForContract); }
static Export[] ResolveExports(this IComponentContext context, ContractBasedImportDefinition cbid) { var componentsForContract = context.ComponentsForContract(cbid); var ts = new TypedService(typeof(Export)); var exportsForContract = new Export[componentsForContract.Count]; var emptyParams = Enumerable.Empty <Parameter>(); for (int i = 0; i < componentsForContract.Count; i++) { exportsForContract[i] = (Export)context.ResolveComponent(ts, componentsForContract[i], emptyParams); } return(exportsForContract); }