I can't find any good examples on MEF2.
I would like to create a plugin directory and use a directory catalog to load up Imports.
What I would like:
- No attributes. Use of the Configuration Builder with Conventions
- Plugin directory
- When a dll is added the application is aware of new Exports available.
Could I just use Castle Windsor for this?
The Conventions Model that was introduced with MEF2 is an alternative to the Attributed Model. Both models can coexist in an application. The Catalogs have a new constuctor that takes a
ReflectionContext
as an argument. The RegisrationBuilder is derived from this class. So you create a RegistrationBuilder, set it up and then create one or more catalogs using the new .ctors and passing it as a ReflectionContext.Have a look at this series of articles introducing MEF2 features. Also have a look at this introductory article from CodeProject.
I haven't used Castle Winsdor so I can't comment on this.