public IronPythonComposablePart(IronPythonTypeWrapper typeWrapper, IList<ExportDefinition> exports, IList<ImportDefinition> imports) { _typeWrapper = typeWrapper; _exports = exports; _imports = imports; _instance = typeWrapper.Activator(); }
public IronPythonComposablePart(IronPythonTypeWrapper typeWrapper, IEnumerable<Type> exports, IEnumerable<KeyValuePair<string, IronPythonImportDefinition>> imports) { _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)} }; 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); } }