System.Composition.Hosting 9.0.0-rc.2.24473.5

About

System.Composition.Hosting is part of the Managed Extensibility Framework (MEF) 2.0, a composition library for .NET that enables dependency injection through attributes or conventions.

This package provides core services for creating composition containers. It offers tools to configure and manage the composition of parts within your application, facilitating dependency injection and enabling modular architectures.

Key Features

  • Create and manage composition containers for dynamic dependency injection.

How to Use

Create a composition host and compose parts.

using System.Composition;
using System.Composition.Hosting;

// Create a container configuration
var configuration = new ContainerConfiguration()
    .WithPart<Service>();

// Create the composition host (container)
using CompositionHost container = configuration.CreateContainer();

// Get an instance of the service
var service = container.GetExport<IService>();
service.Run();
// Service is running!

public interface IService
{
    void Run();
}

[Export(typeof(IService))]
public class Service : IService
{
    public void Run() => Console.WriteLine("Service is running!");
}

Main Types

The main type provided by this library is:

  • System.Composition.CompositionHost

Additional Documentation

Feedback & Contributing

System.Composition.Hosting is released as open source under the MIT license. Bug reports and contributions are welcome at the GitHub repository.

Showing the top 20 packages that depend on System.Composition.Hosting.

Packages Downloads
System.Composition.TypedParts
Provides some extension methods for the Managed Extensibility Framework. Commonly Used Types: System.Composition.CompositionContextExtensions System.Composition.Hosting.ContainerConfiguration
45
System.Composition.TypedParts
Provides some extension methods for the Managed Extensibility Framework. Commonly Used Types: System.Composition.CompositionContextExtensions System.Composition.Hosting.ContainerConfiguration When using NuGet 3.x this package requires at least version 3.4.
44
System.Composition.TypedParts
Provides some extension methods for the Managed Extensibility Framework. Commonly Used Types: System.Composition.CompositionContextExtensions System.Composition.Hosting.ContainerConfiguration
41
System.Composition.TypedParts
Provides some extension methods for the Managed Extensibility Framework. Commonly Used Types: System.Composition.CompositionContextExtensions System.Composition.Hosting.ContainerConfiguration
39
System.Composition
This packages provides a version of the Managed Extensibility Framework (MEF) that is lightweight and specifically optimized for high throughput scenarios, such as the web. Commonly Used Types: System.Composition.ExportAttribute System.Composition.ImportAttribute System.Composition.Convention.ConventionBuilder System.Composition.Hosting.CompositionHost System.Composition.CompositionContext System.Composition.CompositionContextExtensions When using NuGet 3.x this package requires at least version 3.4.
39
System.Composition.TypedParts
Provides some extension methods for the Managed Extensibility Framework. Commonly Used Types: System.Composition.CompositionContextExtensions System.Composition.Hosting.ContainerConfiguration
38
System.Composition
This packages provides a version of the Managed Extensibility Framework (MEF) that is lightweight and specifically optimized for high throughput scenarios, such as the web. Commonly Used Types: System.Composition.ExportAttribute System.Composition.ImportAttribute System.Composition.Convention.ConventionBuilder System.Composition.Hosting.CompositionHost System.Composition.CompositionContext System.Composition.CompositionContextExtensions When using NuGet 3.x this package requires at least version 3.4.
38
System.Composition.TypedParts
Provides some extension methods for the Managed Extensibility Framework. Commonly Used Types: System.Composition.CompositionContextExtensions System.Composition.Hosting.ContainerConfiguration
37
System.Composition.TypedParts
Provides some extension methods for the Managed Extensibility Framework. Commonly Used Types: System.Composition.CompositionContextExtensions System.Composition.Hosting.ContainerConfiguration
36
System.Composition
This packages provides a version of the Managed Extensibility Framework (MEF) that is lightweight and specifically optimized for high throughput scenarios, such as the web. Commonly Used Types: System.Composition.ExportAttribute System.Composition.ImportAttribute System.Composition.Convention.ConventionBuilder System.Composition.Hosting.CompositionHost System.Composition.CompositionContext System.Composition.CompositionContextExtensions When using NuGet 3.x this package requires at least version 3.4.
36
System.Composition.TypedParts
Provides some extension methods for the Managed Extensibility Framework. Commonly Used Types: System.Composition.CompositionContextExtensions System.Composition.Hosting.ContainerConfiguration 7e3dbdb95b30650eabade0ac73a10b22d4dbe8b3 When using NuGet 3.x this package requires at least version 3.4.
35
System.Composition.TypedParts
Provides some extension methods for the Managed Extensibility Framework. Commonly Used Types: System.Composition.CompositionContextExtensions System.Composition.Hosting.ContainerConfiguration When using NuGet 3.x this package requires at least version 3.4.
35
System.Composition.TypedParts
Provides some extension methods for the Managed Extensibility Framework. Commonly Used Types: System.Composition.CompositionContextExtensions System.Composition.Hosting.ContainerConfiguration When using NuGet 3.x this package requires at least version 3.4.
34
System.Composition.TypedParts
Provides some extension methods for the Managed Extensibility Framework. Commonly Used Types: System.Composition.CompositionContextExtensions System.Composition.Hosting.ContainerConfiguration
34
System.Composition
This packages provides a version of the Managed Extensibility Framework (MEF) that is lightweight and specifically optimized for high throughput scenarios, such as the web. Commonly Used Types: System.Composition.ExportAttribute System.Composition.ImportAttribute System.Composition.Convention.ConventionBuilder System.Composition.Hosting.CompositionHost System.Composition.CompositionContext System.Composition.CompositionContextExtensions When using NuGet 3.x this package requires at least version 3.4.
33

.NET Framework 4.6.2

.NET 8.0

.NET 9.0

.NET Standard 2.0

Version Downloads Last updated
9.0.0-rc.2.24473.5 2 10/16/2024
9.0.0-rc.1.24431.7 10 9/12/2024
9.0.0-preview.7.24405.7 16 8/13/2024
9.0.0-preview.6.24327.7 17 7/11/2024
9.0.0-preview.5.24306.7 13 6/14/2024
9.0.0-preview.4.24266.19 13 5/23/2024
9.0.0-preview.3.24172.9 16 4/13/2024
9.0.0-preview.2.24128.5 20 3/16/2024
9.0.0-preview.1.24080.9 26 2/24/2024
8.0.0 30 11/15/2023
8.0.0-rc.2.23479.6 20 10/28/2023
8.0.0-rc.1.23419.4 27 9/15/2023
8.0.0-preview.7.23375.6 29 8/24/2023
8.0.0-preview.6.23329.7 25 8/4/2023
8.0.0-preview.5.23280.8 39 7/13/2023
8.0.0-preview.4.23259.5 24 5/18/2023
8.0.0-preview.3.23174.8 28 5/20/2023
8.0.0-preview.2.23128.3 23 5/20/2023
8.0.0-preview.1.23110.8 32 2/26/2023
7.0.0 23 12/7/2022
7.0.0-rc.2.22472.3 25 12/7/2022
7.0.0-rc.1.22426.10 37 9/18/2022
7.0.0-preview.7.22375.6 40 9/19/2022
7.0.0-preview.6.22324.4 25 9/19/2022
7.0.0-preview.5.22301.12 32 6/30/2022
7.0.0-preview.4.22229.4 27 7/1/2022
7.0.0-preview.3.22175.4 30 7/1/2022
7.0.0-preview.2.22152.2 35 7/1/2022
7.0.0-preview.1.22076.8 38 7/1/2022
6.0.2-mauipre.1.22102.15 38 7/1/2022
6.0.2-mauipre.1.22054.8 27 7/1/2022
6.0.0 24 7/1/2022
6.0.0-rc.2.21480.5 28 7/1/2022
6.0.0-rc.1.21451.13 28 7/1/2022
6.0.0-preview.7.21377.19 29 7/1/2022
6.0.0-preview.6.21352.12 25 7/1/2022
6.0.0-preview.5.21301.5 26 7/1/2022
6.0.0-preview.4.21253.7 34 7/1/2022
6.0.0-preview.3.21201.4 26 7/1/2022
6.0.0-preview.2.21154.6 27 7/1/2022
6.0.0-preview.1.21102.12 30 7/1/2022
5.0.1 33 7/1/2022
5.0.0 28 7/1/2022
5.0.0-rc.2.20475.5 28 7/1/2022
5.0.0-rc.1.20451.14 30 7/1/2022
5.0.0-preview.8.20407.11 26 7/1/2022
5.0.0-preview.7.20364.11 28 7/1/2022
5.0.0-preview.6.20305.6 30 7/1/2022
5.0.0-preview.5.20278.1 31 7/1/2022
5.0.0-preview.4.20251.6 27 7/1/2022
5.0.0-preview.3.20214.6 26 7/1/2022
5.0.0-preview.2.20160.6 31 7/1/2022
5.0.0-preview.1.20120.5 30 7/1/2022
1.4.1 29 7/1/2022
1.4.0 26 7/1/2022
1.4.0-preview3.19551.4 27 7/1/2022
1.4.0-preview2.19523.17 29 7/1/2022
1.4.0-preview1.19504.10 30 7/1/2022
1.3.0 29 7/1/2022
1.3.0-rc1.19456.4 39 7/1/2022
1.3.0-preview9.19421.4 29 7/1/2022
1.3.0-preview9.19416.11 28 7/1/2022
1.3.0-preview8.19405.3 31 7/1/2022
1.3.0-preview7.19362.9 32 7/1/2022
1.3.0-preview6.19303.8 31 7/1/2022
1.3.0-preview6.19264.9 28 7/1/2022
1.3.0-preview5.19224.8 29 7/1/2022
1.3.0-preview4.19212.13 30 7/1/2022
1.3.0-preview3.19128.7 31 7/1/2022
1.3.0-preview.19073.11 38 7/1/2022
1.3.0-preview.18571.3 25 7/1/2022
1.2.0 26 7/1/2022
1.2.0-rc1 30 7/1/2022
1.2.0-preview2-26406-04 29 7/1/2022
1.2.0-preview1-26216-02 27 7/1/2022
1.1.0 29 7/1/2022
1.1.0-preview2-25405-01 26 7/1/2022
1.1.0-preview1-25305-02 25 7/1/2022
1.0.31 27 7/1/2022
1.0.31-preview1-24530-04 30 7/1/2022