One of the interesting things about Silverlight 4 is the inclusion of the Managed Extensibility Framework (MEF) and I think it really helps to build the case for Silverlight 4 as a great platform for business applications.
Silverlight applications are rich internet applications – the deployment model is strongly angled towards web deployment as the only way to install a Silverlight application is to start on a web page and run the application – the deployment is intended to be simple, quick and secure.
As developers build more and increasingly complex applications with Silverlight they can hit a tension between preserving the ethos of Silverlight deployment ( i.e. simple, quick and secure ) and building an application with the rich set of functionality that they need.
They also have to contend with the usual “abilities” of software development like making sure that the application is correct, performant, available, secure, scalable, maintainable and possibly extensible whilst being productive with the code they write.
MEF is one framework that can help in that it simplifies the design of extensible applications and components. It can flexibly and dynamically discover a set of loosely coupled components and analyse their dependencies in order to compose them together at run time.
MEF labels components as composable parts. A composable part is a component that defines ( somehow, MEF is not prescriptive here );
- imports – a set of functionality that it needs ( or might at the least would like ) to have
- exports – functionality that it provides
MEF provides a composition container which is a type that knows how to analyse a set of composable parts to determine which imports/exports can be satisfied in order to tie the componentry together without those parts or any other code necessarily having to come along up-front and introduce or register themselves.
The composition container is very flexible in terms of how composable parts can be introduced into it and one mechanism uses an extensible framework for discovery of parts including ( in Silverlight 4 Beta and the Silverlight 4 Toolkit ) components with the ability to dynamically download additional Silverlight XAPs at runtime and add them into an already running application.
If you’re building Silverlight applications, I think it’s important to get a view of what MEF can do for your application. I’ve been exploring MEF in the Silverlight 4 Beta and have made some screencasts as part of that exploration that ( hopefully! ) might speed up your own explorations. They’re hyperlinked below and I might add some more if time permits.
note – these videos are meant as a series to be chained together rather isolated one-off tutorials so you’ll get a better experience if you find time to watch them all rather than just the first one.
and you can find them all ( and any new ones ) by going here;
http://channel9.msdn.com/tags/learnMEFSL4/
and subscribe to any stuff that I’m posting on Channel 9 by going here;
http://channel9.msdn.com/posts/mtaulty/RSS/