Last post Sep 21, 2015 01:57 PM by Rion Williams
Sep 21, 2015 12:54 PM|sudip_inn|LINK
both are use to inject dependency on the fly then what is difference between DI and MEF. for DI so many library exist like
ninject, unity, autofact etc. when people use MEF instead of ninject, unity, autofact ?
anyone can explain the situation with example like when one prefer MEF instead of ninject, unity, autofact.
Sep 21, 2015 01:57 PM|Rion Williams|LINK
I suppose that it's important to note that the two are slightly related but not the same and they are often used differently. MEF in general is going to be preferred when you want to actually extend applications like Visual Studio without having to include
all sorts of things like COM referenecs (you'll see MEF used quite commonly in Visual Studio extension development) whereas Dependency Injection would be more commonly implemented within an actual application that you might build (such as an MVC application,
The odds are that if you are building a web application, something like Unity, Ninject or one of the other popular DI frameworks would probably be what you are looking for whereas if you wanted to extend an existing desktop application, MEF might be the
I'd highly recommend
looking at this side-by-side comparison of a DI framework (Unity) and MEF, and hopefully it can help clarify some of the exact differences.