I want to talk about this new Managed Extensibility Framework (MEF) idea. It is a library that ships with the .NET Framework 4, as well as Silverlight 4. It allows third parties to extend systems after they are deployed.
There are other technologies which implement the same thing. These include Enterprise Java Beans, Corba, Spring, and the Component Object Model. However some of these competing or legacy technologies are heavyweight. The competitors may also require a lot of developer work.
Let us discuss some of the MEF terminology. A part provides services to other parts. An export is another name for a service. An import is the service that you part uses. And a contract is an identifier.
MEF comes with an attribute programming model. You can achieve the import using constructors. That is called constructor injection. All part instances are currently implemented as singletons. Finally there is a “lazy” framework where instantiation is delayed until the value of the object Is accessed.