MEF Re-factored, Preview 3 has shipped.
We just dropped another release of MEF source. This one includes some significant changes that we’re excited about.
1. We’re now completely MS-PL!!! The StructuredValues dll dependency is now removed. Your free to use the source how you like on Windows and beyond.
2. Container re-factoring – We’ve done an overhaul of the composition container. Outwardly this slightly affects the public API, internally it makes our design cleaner, and easier to extend. I’ll discuss more details on this in my next post, but the diagram below shows the changes. What should be apparent is that we’ve reduced greatly the bi-directional tight coupling 🙁 between the various components. (all the wacky lines)
3. ExportProvider – We’ve replaced the Value Resolver with a new Export Provider. Export Providers are easier to author, and can be used for integrating with external systems. Export Providers can be chained together through using a new AggregatingExportProvider. This allows you to apply custom policies to the container for how exports are discovered.
4. Defaults – The new AggregatingExportProvider is prioritized with Export Provider’s at the top of the chain having higher priority over those at the back. This means you can have defaults such as a default logger which are overridable. These defaults take on a secondary role, which is they allow you to have single imports (like importing a single logger) succeed even if multiple loggers are present. Supporting default behavior is something that the community has been requested repeatedly.
5. Catalog Cache – The catalog now builds a persistent cache of all the metadata for parts in the catalog. Until the part is instantiated, it’s assembly will not get loaded. For lazy loading this means if a part imports an Export<IFoo> then the Foo assembly will not be loaded until GetExportedObject is called.
6. Performance tweaks – We’ve done a bunch of significant perf enhancements to the container / composition.
7. Unit Tests – We heard you loud and clear that you wanted to see them, well now we’ve included our full suite of unit tests.
As I mentioned above, I’ll be doing some follow up posts to talk about the changes in detail.
You can get the bits here.