System.Composition 9.0.0
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
Related Packages
- System.Composition.AttributedModel
- System.Composition.Convention
- System.Composition.Hosting
- System.Composition.Runtime
- System.Composition.TypedParts
Feedback & Contributing
System.Composition 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.
Packages | Downloads |
---|---|
Microsoft.CodeAnalysis
.NET Compiler Platform ("Roslyn").
This is the all-in-one package (a superset of all assemblies). You can install any of these sub-packages if you only want part of the functionality:
- "Microsoft.CodeAnalysis.CSharp.Workspaces" (C# compiler + services)
- "Microsoft.CodeAnalysis.VisualBasic.Workspaces" (VB compiler + services)
- "Microsoft.CodeAnalysis.Compilers" (both compilers)
- "Microsoft.CodeAnalysis.CSharp" (only the C# compiler)
- "Microsoft.CodeAnalysis.VisualBasic (only the VB compiler)
More details at https://aka.ms/roslyn-packages
This package was built from the source at https://github.com/dotnet/roslyn/commit/bde21ee2b98b775b010d01a93f81ef587fe80962.
|
1 |
Microsoft.CodeAnalysis.VisualBasic.Features
.NET Compiler Platform ("Roslyn") support for creating Visual Basic editing experiences.
More details at https://aka.ms/roslyn-packages
This package was built from the source at https://github.com/dotnet/roslyn/commit/bde21ee2b98b775b010d01a93f81ef587fe80962.
|
1 |
Microsoft.CodeAnalysis.Features
.NET Compiler Platform ("Roslyn") support for creating editing experiences.
More details at https://aka.ms/roslyn-packages
This package was built from the source at https://github.com/dotnet/roslyn/commit/bde21ee2b98b775b010d01a93f81ef587fe80962.
|
1 |
Microsoft.CodeAnalysis.CSharp.Workspaces
.NET Compiler Platform ("Roslyn") support for analyzing C# projects and solutions.
More details at https://aka.ms/roslyn-packages
This package was built from the source at https://github.com/dotnet/roslyn/commit/bde21ee2b98b775b010d01a93f81ef587fe80962.
|
1 |
Microsoft.CodeAnalysis.CSharp.Features
.NET Compiler Platform ("Roslyn") support for creating C# editing experiences.
More details at https://aka.ms/roslyn-packages
This package was built from the source at https://github.com/dotnet/roslyn/commit/bde21ee2b98b775b010d01a93f81ef587fe80962.
|
1 |
Microsoft.CodeAnalysis.VisualBasic.Workspaces
.NET Compiler Platform ("Roslyn") support for analyzing Visual Basic projects and solutions.
More details at https://aka.ms/roslyn-packages
This package was built from the source at https://github.com/dotnet/roslyn/commit/bde21ee2b98b775b010d01a93f81ef587fe80962.
|
1 |
.NET Framework 4.6.2
- System.Composition.AttributedModel (>= 9.0.0)
- System.Composition.Convention (>= 9.0.0)
- System.Composition.Hosting (>= 9.0.0)
- System.Composition.Runtime (>= 9.0.0)
- System.Composition.TypedParts (>= 9.0.0)
.NET 8.0
- System.Composition.AttributedModel (>= 9.0.0)
- System.Composition.Convention (>= 9.0.0)
- System.Composition.Hosting (>= 9.0.0)
- System.Composition.Runtime (>= 9.0.0)
- System.Composition.TypedParts (>= 9.0.0)
.NET 9.0
- System.Composition.AttributedModel (>= 9.0.0)
- System.Composition.Convention (>= 9.0.0)
- System.Composition.Hosting (>= 9.0.0)
- System.Composition.Runtime (>= 9.0.0)
- System.Composition.TypedParts (>= 9.0.0)
.NET Standard 2.0
- System.Composition.AttributedModel (>= 9.0.0)
- System.Composition.Convention (>= 9.0.0)
- System.Composition.Hosting (>= 9.0.0)
- System.Composition.Runtime (>= 9.0.0)
- System.Composition.TypedParts (>= 9.0.0)