public IronPythonComposablePart(IronPythonTypeWrapper typeWrapper, IEnumerable <Type> exports, IEnumerable <KeyValuePair <string, IronPythonImportDefinition> > imports, IDictionary <object, object> exportMetadatas) { _typeWrapper = typeWrapper; _instance = typeWrapper.Activator(); _exports = new List <ExportDefinition>(exports.Count()); _imports = new Dictionary <string, ImportDefinition>(imports.Count()); foreach (var export in exports) { var metadata = new Dictionary <string, object>() { { "ExportTypeIdentity", AttributedModelServices.GetTypeIdentity(export) } }; if (exportMetadatas != null) { foreach (var data in exportMetadatas) { metadata.Add(data.Key.ToString(), data.Value); } } var contractName = AttributedModelServices.GetContractName(export); _exports.Add(new ExportDefinition(contractName, metadata)); } foreach (var import in imports) { var contractName = AttributedModelServices.GetContractName(import.Value.Type); var metadata = new Dictionary <string, Type>(); _imports[import.Key] = new IronPythonContractBasedImportDefinition( import.Key, contractName, AttributedModelServices.GetTypeIdentity(import.Value.Type), metadata.ToList(), import.Value.Cardinality, import.Value.IsRecomposable, import.Value.IsPrerequisite, CreationPolicy.Any); } }
public IronPythonComposablePart(IronPythonTypeWrapper typeWrapper, IEnumerable<Type> exports, IEnumerable<KeyValuePair<string, IronPythonImportDefinition>> imports, IDictionary<object, object> exportMetadatas) { _typeWrapper = typeWrapper; _instance = typeWrapper.Activator(); _exports = new List<ExportDefinition>(exports.Count()); _imports = new Dictionary<string, ImportDefinition>(imports.Count()); foreach (var export in exports) { var metadata = new Dictionary<string, object>() { {"ExportTypeIdentity", AttributedModelServices.GetTypeIdentity(export)} }; if (exportMetadatas != null) { foreach (var data in exportMetadatas) { metadata.Add(data.Key.ToString(), data.Value); } } var contractName = AttributedModelServices.GetContractName(export); _exports.Add(new ExportDefinition(contractName, metadata)); } foreach (var import in imports) { var contractName = AttributedModelServices.GetContractName(import.Value.Type); var metadata = new Dictionary<string, Type>(); _imports[import.Key] = new IronPythonContractBasedImportDefinition( import.Key, contractName, AttributedModelServices.GetTypeIdentity(import.Value.Type), metadata.ToList(), import.Value.Cardinality, import.Value.IsRecomposable, import.Value.IsPrerequisite, CreationPolicy.Any); } }