MEF for everything!

In the first of a series of blogs around my Commons Library, I want to shed more light on my choice of MEF as the underlying mechanism for the AK.Commons.Composition namespace - which handles dependency injection as well as extensibility or plugin type stuff. I like its attribute based syntax, choice of different types of catalogs and dynamic discovery (and yes, I am not using dynamic discovery just yet but I intend to; the same goes for taking advantage of different types of catalogs). The following three features, however, stood out for me:

One other factor is that MEF is part of the framework as opposed to being a third party library, and that Microsoft is behind it. That means one less third party dependency to deal with if you wanted to use AK.Commons. I already have this cool extensibility mechanism that is part of the framework, and it does what I need for DI. Why not use it for DI as well? I have heard the whole “MEF is not for DI” debate quite a bit. It has worked well for me so far though.

One thing I miss in MEF is support for AOP. I do intend to do something about that pretty soon though!

Tags: mef csharp dotnet
Previous: The Commons Library
Next: Handling Duplicate Libraries with MEF


comments powered by Disqus