diff --git a/src/libraries/System.Composition/src/PACKAGE.md b/src/libraries/System.Composition/src/PACKAGE.md new file mode 100644 index 0000000000000..d6378b7ed0d56 --- /dev/null +++ b/src/libraries/System.Composition/src/PACKAGE.md @@ -0,0 +1,77 @@ +## 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. + +```csharp +using System.Composition; +using System.Composition.Hosting; + +var configuration = new ContainerConfiguration().WithPart(); + +using var container = configuration.CreateContainer(); + +var service = container.GetExport(); +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 + + + +* [API documentation](https://learn.microsoft.com/dotnet/api/system.composition) +* [Managed Extensibility Framework (MEF)](https://learn.microsoft.com/dotnet/framework/mef/) + +## Related Packages + + + +* [System.Composition.AttributedModel](https://www.nuget.org/packages/System.Composition.AttributedModel) +* [System.Composition.Convention](https://www.nuget.org/packages/System.Composition.Convention) +* [System.Composition.Hosting](https://www.nuget.org/packages/System.Composition.Hosting) +* [System.Composition.Runtime](https://www.nuget.org/packages/System.Composition.Runtime) +* [System.Composition.TypedParts](https://www.nuget.org/packages/System.Composition.TypedParts) + +## Feedback & Contributing + + + +System.Composition is released as open source under the [MIT license](https://licenses.nuget.org/MIT). +Bug reports and contributions are welcome at [the GitHub repository](https://github.com/dotnet/runtime). diff --git a/src/libraries/System.Composition/src/System.Composition.csproj b/src/libraries/System.Composition/src/System.Composition.csproj index 0d0c67320ef72..a360f80b58e2b 100644 --- a/src/libraries/System.Composition/src/System.Composition.csproj +++ b/src/libraries/System.Composition/src/System.Composition.csproj @@ -8,21 +8,10 @@ $(NoWarn);NU5128 false - 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. - -Commonly Used Types: -System.Composition.ExportAttribute -System.Composition.ImportAttribute -System.Composition.Convention.ConventionBuilder -System.Composition.Hosting.CompositionHost -System.Composition.CompositionContext -System.Composition.CompositionContextExtensions - + Provides a version of the Managed Extensibility Framework (MEF) that is lightweight and specifically optimized for high throughput scenarios, such as the web. disable $(NoWarn);nullable - - false