S.No |
MEF
|
DI
/ IOC
|
1
|
Abbreviation:
MEF
stands for Managed Extensibility Framework
|
Abbreviation:
DI
/ IOC stands for Dependency Injection and Inversion Of Control
|
2 |
Meaning:
Managed
Extensibility Framework (MEF) is a component of .NET Framework
4.0 for creating lightweight, extensible applications. It allows
application developers to discover and use extensions with no
configuration required. It also lets extension developers easily
encapsulate code and avoid fragile hard dependencies. MEF not
only allows extensions to be reused within applications, but
across applications as well. MEF was introduced as a part of .NET
4.0 and Silverlight 4.
|
Meaning:
Dependency
injection is a software design pattern that allows a choice of
component to be made at run-time rather than compile time. This
can be used, for example, as a simple way to load plugins
dynamically or to choose mock objects in test environments vs.
real objects in production environments. This software design
pattern injects the dependent element (object or value etc) to
the destination automatically by knowing the requirement of the
destination.Inversion of Control usually refers to the
"containers" while Dependency Injection refers to the
actual pattern.DI is a form of IoC.Dependency injection is the
main method to implement Inversion of Control.
|
3 |
Where it can be used ?
MEF
is useful for dynamic dependencies.
|
Where it can be used ?
IOC
is most useful with Static dependencies
|
4 |
Used for Known / Unknown parts:
MEF
is for discovery of unknown parts.
|
Used for Known / Unknown parts:
IOC
is for registration of known parts.
|
5 |
Best choice for 3rd party controls or not:
When
working with/for 3rd party dlls , MEF is more the best choice.
|
Best choice for 3rd party controls or not:
When
working with/for 3rd party dlls , IOC is not the best choice.
|
6 |
Swapping DLLs at runtime possible or not:
If
we have two dlls, taking a decision at runtime to swap the two is
possible using MEF.
|
Swapping DLLs at runtime possible or not:
If
we have two dlls, taking a decision at runtime to swap the two is
not possible using IOC.
|
7 |
Plug-in
versioning problem:
Plug-in
versioning problem is not there in MEF
|
Plug-in
versioning problem:
Plug-in
versioning problem is there in IOC
|
No comments:
Post a Comment