I am using Autofac as the IoC container in a project. I am loading "plugins" into my container through MEF using the Autofac Mef integration library. All working well.
I am also using the decorator pattern on a couple of services, which causes me headache. This is how I register one of them:
builder.RegisterDecorator<IAuthorizationHandler>((context, handler) =>
context.Resolve<CachedAuthManager>(new Parameter[] { new NamedParameter("manager", handler) }), "authhandler", "authcached");
Now I wish to export one of these to MEF. I cannot apply the extension method "Exports" in the example above to the builder, as I usually do on the container builder, like this example:
builder.RegisterType<LogHandler>().As<ILogHandler>).Exported(x => x.As<ILogHandler>());
How do I properly and cleanly tell Autofac that my registered, decorated component is to be exported to MEF?
Thanks for helping out