/// <summary>
 /// Construtor padrão.
 /// </summary>
 /// <param name="catalog"></param>
 /// <param name="typeName"></param>
 /// <param name="exportDefinitions"></param>
 /// <param name="importDefinitions"></param>
 /// <param name="parameterImportDefinitions"></param>
 /// <param name="partCreationPolicy"></param>
 /// <param name="useDispatcher"></param>
 public ProviderComposablePartDefinition(ComposablePartCatalog catalog, Colosoft.Reflection.TypeName typeName, IList <ProviderExportDefinition> exportDefinitions, Lazy <IEnumerable <ImportDefinition> > importDefinitions, ProviderParameterImportDefinitionContainer parameterImportDefinitions, System.ComponentModel.Composition.CreationPolicy partCreationPolicy, bool useDispatcher)
 {
     _exports = exportDefinitions.Cast <ExportDefinition>().ToArray();
     _imports = importDefinitions;
     _parameterImportDefinitions = parameterImportDefinitions;
     _catalog            = catalog;
     _typeName           = typeName;
     _partCreationPolicy = partCreationPolicy;
     _useDispatcher      = useDispatcher;
 }
        /// <summary>
        /// Gets a list of all composable part definitions which was discovered by the catalog.
        /// </summary>
        /// <returns>A <see cref="List{T}"/> object.</returns>
        private List <ProviderComposablePartDefinition> GetComposablePartDefinitions()
        {
            var definitions = new List <ProviderComposablePartDefinition>();

            foreach (PartDescription part in _partDescriptions)
            {
                var container = new ProviderParameterImportDefinitionContainer(part, _assemblies);
                definitions.Add(new ProviderComposablePartDefinition(this, part.TypeName, GetExportDefinitions(part), GetImportDefinitions(part, container), container, part.PartCreationPolicy, part.UseDispatcher));
            }
            return(definitions);
        }
 /// <summary>
 /// Recupera uma lista de todas as definições de import da parte.
 /// </summary>
 /// <param name="part"></param>
 /// <param name="providerParameterImportContainer"></param>
 /// <returns></returns>
 private Lazy <IEnumerable <ImportDefinition> > GetImportDefinitions(PartDescription part, ProviderParameterImportDefinitionContainer providerParameterImportContainer)
 {
     return(new Lazy <IEnumerable <ImportDefinition> >(() => {
         var imports = new List <ImportDefinition>();
         foreach (var i in part.Imports)
         {
             ImportDescription import = i;
             imports.Add(new ProviderImportDefinition(new Lazy <System.Reflection.MemberInfo>(() => GetMemberInfo(part.TypeName, import.MemberName), false), import, part.PartCreationPolicy));
         }
         foreach (var i in providerParameterImportContainer.GetImportDefinitions())
         {
             imports.Add(i);
         }
         return imports;
     }));
 }