Reading through this MSDN article http://msdn.microsoft.com/en-us/library/dd460648.aspx I’m seeing a claim that MEF doesn’t have a hard dependency on assemblies. I’m not exactly sure what this means because even though the contracts are strings, MEF still resolves by string, then by type. So both the host and extension assemblies need a reference to the contract assembly. Is this not a hard dependency?
The Managed Extensibility Framework or MEF is a library 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.
Finally, the component developers must accept a hard dependency on
what assembly contains the interface they implement. This makes it
difficult for a component to be used in more than one application, and
can also create problems when you create a test framework for
components.
Because the MEF model requires no hard dependency on a particular
application assembly, it allows extensions to be reused from
application to application. This also makes it easy to develop a test
harness, independent of the application, to test extension components.
Can someone explain this to me? Maybe I misunderstand what a hard dependency really is?
It’s saying that the only hard dependency (meaning that you explicitly reference the assembly) is on the assembly that defines your interface. The assemblies with specific implementations of that interface are not hard dependencies.