May 25, 2009 at 4:34 PM
Edited May 25, 2009 at 4:34 PM
My goal is to use the attributed programming model (APM) without having to load all of the assemblies in my application when the application starts. The problem that I see is that the out-of-the-box catalogs (namely, AssemblyCatalog, DirectoryCatalog,
and TypeCatalog) seem to require that the assemblies for all APM-attributed types to be loaded.
A few approaches that I've considered:
a) Create a custom catalog that uses Cecil or CCI instead of reflection.
b) Use Cecil or CCI but leverage existing infrastructure by building a TypeCatalog where the Types are custom implementations of System.Type (similar to what's described at http://codebetter.com/blogs/glenn.block/archive/2009/04/27/poco-mef-and-custom-type-systems-are-you-ready-to-take-the-red-pill.aspx).
c) Create a custom ExportProvider that uses Cecil or CCI to discover and return exports.
d) Generate cached information and somehow provide this information to MEF. gblock indicated that this would be "very easy" in an earlier thread (http://mef.codeplex.com/Thread/View.aspx?ThreadId=49511), but I'm not seeing the mechanism for
doing this in preview 5.
All approaches (except maybe d) seem like a lot of effort. It seems like this would be a very common scenario, particularly in medium to large size applications, so I'm thinking that there must be some easier way to do this or this has already been
done by somebody else.