private IEnumerable <CompositionContractInfo> AnalyzeContracts() { var contracts = new Dictionary <string, CompositionContractInfo>(); foreach (var pd in PartDefinitions) { foreach (var e in pd.PartDefinition.ExportDefinitions) { CompositionContractInfo ci; if (!contracts.TryGetValue(e.ContractName, out ci)) { contracts[e.ContractName] = ci = new CompositionContractInfo(new ContractInfo( e.ContractName, TypeIdentity(e), e.Metadata.Select(m => new KeyValuePair <string, Type>(m.Key, m.Value.GetType())))); } ci.Exporters.Add(pd); } foreach (var i in pd.ImportDefinitions) { CompositionContractInfo ci; if (!contracts.TryGetValue(i.ContractInfo.ContractName, out ci)) { contracts[i.ContractInfo.ContractName] = ci = new CompositionContractInfo(i.ContractInfo); } ci.Importers.Add(pd); } } return(contracts.Values); }
private IEnumerable<CompositionContractInfo> AnalyzeContracts() { var contracts = new Dictionary<string, CompositionContractInfo>(); foreach (var pd in PartDefinitions) { foreach (var e in pd.PartDefinition.ExportDefinitions) { CompositionContractInfo ci; if (!contracts.TryGetValue(e.ContractName, out ci)) contracts[e.ContractName] = ci = new CompositionContractInfo(new ContractInfo( e.ContractName, TypeIdentity(e), e.Metadata.Select(m => new KeyValuePair<string, Type>(m.Key, m.Value.GetType())))); ci.Exporters.Add(pd); } foreach (var i in pd.ImportDefinitions) { CompositionContractInfo ci; if (!contracts.TryGetValue(i.ContractInfo.ContractName, out ci)) contracts[i.ContractInfo.ContractName] = ci = new CompositionContractInfo(i.ContractInfo); ci.Importers.Add(pd); } } return contracts.Values; }