Difference between MEF and IoC containers (like Unity, Autofac, SMap, Ninject, Windsor.Spring.net, etc.)

Eventually what I have concluded about the MEF vs IoC container is as follows: MEF is preferred to be used when one has to deal with unknown types or a plugin based architecture. IoC containers are preferred to be used with known types. Moreover, MEF is an architectural solution for dependency injection Whereas, IoC containers … Read more

Disadvantages of Lazy?

I’ll expand a bit on my comment, which reads: I’ve just started using Lazy, and find that it’s often indicative of bad design; or laziness on the part of the programmer. Also, one disadvantage is that you have to be more vigilant with scoped up variables, and create proper closures. For example, I’ve used Lazy<T> … Read more

What is different between and purpose of MEF and Unity?

The main difference is that with unity you will explicitly register each class you want to use in the composition: var container = new UnityContainer(); container.RegisterType<IFoo,Foo>(); container.RegisterType<IBar,Bar>(); … var program = container.Resolve<Program>(); program.Run(); In MEF on the other hand, you mark classes with attributes instead of registering them somewhere else: [Export(typeof(IFoo))] public Foo { … … Read more

MEF (Managed Extensibility Framework) vs IoC/DI

The principle purpose of MEF is extensibility; to serve as a ‘plug-in’ framework for when the author of the application and the author of the plug-in (extension) are different and have no particular knowledge of each other beyond a published interface (contract) library. Another problem space MEF addresses that’s different from the usual IoC suspects, … Read more

Where can I learn about MEF? [closed]

I haven’t found a really comprehensive page, but there are a few: Microsoft Docs Simple Example from a msdn blog Code Project’s Introduction to MEF (part 1) MEF 101 part A from Geek with Blogs MEF 101 part B Another MSDN blog, a little more history than tutorial

MEF vs. any IoC

When boiled down, the main difference is that IoC containers are generally most useful with static dependencies (known at compile-time), and MEF is generally most useful with dynamic dependencies (known only at run-time). As such, they are both composition engines, but the emphasis is very different for each pattern. Design decisions thus vary wildly, as … Read more