System.Composition (9.0.0)

Published 2026-09-09 02:38:36 +03:30 by kayer

Installation

dotnet nuget add source --name kayer --username your_username --password your_token 
dotnet add package --source kayer --version 9.0.0 System.Composition

About this package

Provides a version of the Managed Extensibility Framework (MEF) that is lightweight and specifically optimized for high throughput scenarios, such as the web.

About

Provides the Managed Extensibility Framework (MEF) 2.0, a lightweight, attribute-driven Dependency Injection (DI) container.

MEF simplifies the composition of applications by allowing components to be loosely coupled and dynamically discovered. This package supports the development of modular and maintainable applications by enabling parts to be composed at runtime.

Key Features

  • Components are discovered and composed using attributes.
  • Provides dependency injection capabilities for loosely coupled modules.

How to Use

Running code from a discovered component.

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

var configuration = new ContainerConfiguration().WithPart<Service>();

using var container = configuration.CreateContainer();

var service = container.GetExport<Service>();
service.Execute();
// Output: Service is running!

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

Main Types

The main types provided by this library are:

  • System.Composition.ExportAttribute
  • System.Composition.ImportAttribute
  • System.Composition.Convention.ConventionBuilder
  • System.Composition.Hosting.CompositionHost
  • System.Composition.CompositionContext
  • System.Composition.CompositionContextExtensions

Additional Documentation

Feedback & Contributing

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

Dependencies

ID Version Target Framework
System.Composition.AttributedModel 9.0.0 .NETFramework4.6.2
System.Composition.Convention 9.0.0 .NETFramework4.6.2
System.Composition.Hosting 9.0.0 .NETFramework4.6.2
System.Composition.Runtime 9.0.0 .NETFramework4.6.2
System.Composition.TypedParts 9.0.0 .NETFramework4.6.2
System.Composition.AttributedModel 9.0.0 .NETStandard2.0
System.Composition.Convention 9.0.0 .NETStandard2.0
System.Composition.Hosting 9.0.0 .NETStandard2.0
System.Composition.Runtime 9.0.0 .NETStandard2.0
System.Composition.TypedParts 9.0.0 .NETStandard2.0
System.Composition.AttributedModel 9.0.0 net8.0
System.Composition.Convention 9.0.0 net8.0
System.Composition.Hosting 9.0.0 net8.0
System.Composition.Runtime 9.0.0 net8.0
System.Composition.TypedParts 9.0.0 net8.0
System.Composition.AttributedModel 9.0.0 net9.0
System.Composition.Convention 9.0.0 net9.0
System.Composition.Hosting 9.0.0 net9.0
System.Composition.Runtime 9.0.0 net9.0
System.Composition.TypedParts 9.0.0 net9.0
Details
NuGet
2026-09-09 02:38:36 +03:30
7
Microsoft
48 KiB
Assets (2)
Versions (2) View all
9.0.0 2026-09-09
7.0.0 2026-02-04