Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MEF2 how does the catalogs work? Looks like it's been removed

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:

  1. No attributes. Use of the Configuration Builder with Conventions
  2. Plugin directory
  3. When a dll is added the application is aware of new Exports available.

Could I just use Castle Windsor for this?

like image 418
Chris Kolenko Avatar asked Oct 03 '22 07:10

Chris Kolenko


1 Answers

If you're referring to the new Windows Store version of MEF available on nuget, then the documentation states,

There is no catalog concept, nor composition batches, nor any “container hierarchy” or composition scoping APIs.

Sounds crazy to an MEF 1 developer, but the page explains the rationale well. However, you require:

  • When a dll is added the application is aware of new Exports available.

This is explicitly unavailable in MEF 2 (Win Store) version, since it doesn't support re-composition. For that you need the "full" MEF from the .NET Framework, in System.ComponentModel.Composition.

like image 143
Olly Avatar answered Oct 12 '22 10:10

Olly