/// <summary> /// Adds parts that allow MEF to work on .NET Framework platforms. /// </summary> /// <param name="catalog">The catalog to add desktop support to.</param> /// <returns>The catalog that includes desktop support.</returns> public static ComposableCatalog WithDesktopSupport(this ComposableCatalog catalog) { Requires.NotNull(catalog, nameof(catalog)); return(catalog .AddPart(MetadataViewImplProxyPart) .WithMetadataViewEmitProxySupport()); }
/// <summary> /// Creates a catalog that exports an instance of <see cref="MefV1.ICompositionService"/>. /// </summary> /// <param name="catalog">The catalog to add the export to.</param> /// <returns>A catalog that includes <see cref="MefV1.ICompositionService"/>.</returns> public static ComposableCatalog WithCompositionService(this ComposableCatalog catalog) { Requires.NotNull(catalog, nameof(catalog)); var modifiedCatalog = catalog.AddPart(CompositionServicePart); return(modifiedCatalog); }
/// <summary> /// Adds support for queries to <see cref="ExportProvider.GetExports{T, TMetadata}()"/> where /// <c>TMetadata</c> is an interface. /// </summary> /// <param name="catalog">The catalog from which constructed ExportProviders may have this support added.</param> /// <returns>The catalog with the additional support.</returns> public static ComposableCatalog WithMetadataViewEmitProxySupport(this ComposableCatalog catalog) { Requires.NotNull(catalog, nameof(catalog)); return(catalog.AddPart(ProxySupportPartDefinition)); }