Skip to content

Managed Extensibility Framework (MEF) integration for Autofac IoC

License

Notifications You must be signed in to change notification settings

autofac/Autofac.Mef

Repository files navigation

Autofac.Mef

Managed Extensibility Framework (MEF) integration for Autofac.

Build status

Please file issues and pull requests for this package in this repository rather than in the Autofac core repo.

Quick Start

The Autofac/MEF integration allows MEF catalogs to be registered with the ContainerBuilder using the RegisterComposablePartCatalog() extension method. If you register a component using MEF and want to provide Autofac components into that MEF component, use the Exported() extension.

var builder = new ContainerBuilder();
var catalog = new DirectoryCatalog(@"C:\MyExtensions");
builder.RegisterComposablePartCatalog(catalog);
builder.RegisterType<Component>()
       .Exported(x => x.As<IService>().WithMetadata("SomeData", 42));

Check out the Autofac MEF integration documentation for more information.

Get Help

Need help with Autofac? We have a documentation site as well as API documentation. We're ready to answer your questions on Stack Overflow or check out the discussion forum.