Easier TypeCatalog

Dec 28, 2011 at 5:49 PM

Hi,
I've got confused when using MEF2 framework and hopefully this will help others if they get to the same problem.
I've read about the new RegistrationBuilder which allow to use "register by convention" way. The nice thing there is that I don't have to put ExportAttribute all over my types.

I've got confused when try to use TypeCatalog by to create a catalog of types which do not have Export attribute on them. I fail to realize I have to either have Export attribute or pass a RegistrationBuilder to the TypeCatalog.

Proposal:
It will be handy to have something like TypeCatalog to which I can pass types that I want to have in the catalog without the need to create RegistrationBuilder for them. I can think of corner cases like multiple ctors which may pose difficulty but maybe it worth thinking about.

Thank you,

Ido.

Dec 28, 2011 at 5:54 PM

Hi Ido,

In the new ASP.NET MVC integration, we include a type called MvcApplicationCatalog. The catalog is loosely based on AssemblyCatalog, and by default defines some conventions around the "Parts" namespace.

http://blogs.msdn.com/b/bclteam/archive/2011/11/11/using-mef-2-with-asp-net-mvc-3.aspx

http://mef.codeplex.com/SourceControl/changeset/view/86527#1693887

The approach taken with MvcApplicationCatalog might be along the lines you are looking for - with all of the MVC-specific functionality removed, of course. Thoughts?

Nick

 

Dec 28, 2011 at 6:28 PM

Yes, this seem like the right way.

 

Thank you,

Ido.