MEF in Silverlight 4 – a guided tourMike TaultyMicrosoft Ltdmtaulty@microsoft.commtaulty.comtwitter.com/mtaulty
[background]
MEF – What is it? How do I get it?the Managed Extensibility Frameworkan extensible framework for composing applications from a set of loosely-coupled parts discovered and evolving at run-time versions.NET Framework shipping with Silverlight 4 .NET Framework 4 shipping with VS 2010Silverlight 3 & .NET Framework V3.5 Sp1Source on CodePlex
“scenario”iTunesMediaPlayerConstructor()GetAlbumInfo(“Blood on the Tracks”)IAlbumInfoProviderAlbumInfoProviderConstructor()GetAlbumArt(“Blood on the Tracks”)IAlbumArtProviderAlbumArtProvider
“scenario”iTunesMediaPlayerConstructor()GetAlbumInfo(“Blood on the Tracks”)AlbumInfoProviderConstructor()GetAlbumArt(“Blood on the Tracks”)AlbumArtProviderStatic dependency AlbumInfoProvider->AlbumArtProvider
Hard to test AlbumInfoProvider in isolation from AlbumArtProvider
Hard to drop in a different AlbumArtProvider implementation
Code changes to AlbumArtProvider impact AlbumInfoProviderInversion of Control ( IoC )iTunesMediaPlayerIAlbumArtProviderConstructor()Works ok for the single dependency case but this won’t scale to trees of objects of arbitrary complexityAlbumArtProviderAlbumArtProviderConstructor(IAlbumArtProvider)GetAlbumInfo(“Blood on the Tracks”)AlbumInfoProviderGetAlbumArt(“Blood on the Tracks”)Static dependency AlbumInfoProvider->IAlbumArtProvider
Easier to test AlbumInfoProvider with anyIAlbumArtProvider
Easier to drop in new implementations of IAlbumArtProvider
Version changes to AlbumArtProvider do not impact AlbumInfoProviderthe IoC Container“RegisterMapping “typeof(IAlbumArtProvider)  typeof(AlbumArtProvider)“RegisterMapping “typeof(IAlbumInfoProvider)  typeof(AlbumInfoProvider)Container
the IoC ContainerContaineriTunesMediaPlayerGet<IAlbumInfoProvider>()AlbumArtProviderAlbumArtProviderConstructor(IAlbumArtProvider)Constructor(IAlbumArtProvider)AlbumInfoProviderAlbumInfoProvider
[end of background]
example ( Unity IoC )
but MEF is not ‘just’ another IoC containeran extensible framework for composing applications from a set of loosely-coupled parts discovered and evolving at run-time
using MEF in our scenariodemo
MEF models composable partsimportimportimportPartexportexport
MEF composes partsimportimportimportimportimportimportimportpartpartpartpartimportimportexportexportexportComposition Engineexportpartpartpartpartpart
which parts compose together?importimportimportpartexportexport?importpart
matching imports to exportsdemo
parts & part definitionsimportimportimportimportPartPartDefinitionCreatePart()exportexportexportPartDefinition is a blueprint for a Partsimilar to Object and Type in .NETbut can have Part without PartDefinition
container draws parts from catalogsPartDefinitionPartDefinitionPartDefinitionPartDefinitionPartDefinitionPartDefinitionPartDefinitionPartDefinitionPartDefinitionimportimportimportPartDefinitionimportimportimportPartDefinitionimportimportimportPartDefinitionPartPartPartCatalogCatalogCatalogexportexportexportexportexportexportCatalogCompositionContainer

More Related Content

TXT
vvvvReadme
PDF
Egyensúly és harmónia a didaktikában
PPTX
Silverlight 4
PDF
Silverlight 4
PDF
Silverlight 4.0 a technológia és ami mögötte van
PPT
AMI - Silverlight
PPTX
Silverlight 4
PPTX
Silverlight 4
vvvvReadme
Egyensúly és harmónia a didaktikában
Silverlight 4
Silverlight 4
Silverlight 4.0 a technológia és ami mögötte van
AMI - Silverlight
Silverlight 4
Silverlight 4

Similar to MEF in Silverlight 4 - a guided tour (20)

PPTX
Managed Extensibility Framework or Effective Development of Scalable Applicat...
PDF
Managed Extensibility Framework
PPT
Mike Taulty Beyond Silverlight With W P F
PPT
Extending the Enterprise with MEF
PPT
What's New for Presentation in Visual Studio 2008 SP1
PPTX
MEF Deep Dive by Piotr Wlodek
ODP
Plug yourself in and your app will never be the same (2 hour edition)
ODP
Plug yourself in and your app will never be the same (2 hr editon)
PDF
All the Laravel things: up and running to making $$
PPT
VMware Studio & vAPP-s
PPT
Screenshot from 2024-05-28 16-46-45 (30 files merged).ppt
DOCX
​Abinitio online training
PDF
IoT Seminar (Oct. 2016) Alex Edelmann - Bosch Singapore
PDF
Reusando componentes Zope fuera de Zope
PPTX
Lap around .net 4
PPT
Adobe is from Mars, Microsoft is from Uranus. A look at two competing web st...
PPT
SynapseIndia dotnet development framework
PPTX
Power Apps Component Framework - Dynamics Power! 365 Paris 2019
PPT
java swing programming
PPT
Railo Presentation Railo 3.1
Managed Extensibility Framework or Effective Development of Scalable Applicat...
Managed Extensibility Framework
Mike Taulty Beyond Silverlight With W P F
Extending the Enterprise with MEF
What's New for Presentation in Visual Studio 2008 SP1
MEF Deep Dive by Piotr Wlodek
Plug yourself in and your app will never be the same (2 hour edition)
Plug yourself in and your app will never be the same (2 hr editon)
All the Laravel things: up and running to making $$
VMware Studio & vAPP-s
Screenshot from 2024-05-28 16-46-45 (30 files merged).ppt
​Abinitio online training
IoT Seminar (Oct. 2016) Alex Edelmann - Bosch Singapore
Reusando componentes Zope fuera de Zope
Lap around .net 4
Adobe is from Mars, Microsoft is from Uranus. A look at two competing web st...
SynapseIndia dotnet development framework
Power Apps Component Framework - Dynamics Power! 365 Paris 2019
java swing programming
Railo Presentation Railo 3.1
Ad

More from mark mann (11)

PPTX
"Ui2" Pitch by Matt Mould for #TFTLondon
PPTX
"iLife" Pitch by Lee Provoost for #TFTLondon
PPTX
"Scorepedia" Pitch by Jamie Thomson for #TFTLondon
PPTX
MIX10 Roundup: Developer's Overview
PPTX
MIX10 Roundup: Expression Blend 4
PPTX
Working with the Bing Maps Silverlight Control
PPTX
Silverlight UK User Group #11 Introduction
PPTX
Silverlight UK User Group #10 Introduction
PPTX
Designer-Developer Interaction
PPTX
PRISM and Silverlight
PPTX
SilverlightPulse.NET [Silverlight UK User Group]
"Ui2" Pitch by Matt Mould for #TFTLondon
"iLife" Pitch by Lee Provoost for #TFTLondon
"Scorepedia" Pitch by Jamie Thomson for #TFTLondon
MIX10 Roundup: Developer's Overview
MIX10 Roundup: Expression Blend 4
Working with the Bing Maps Silverlight Control
Silverlight UK User Group #11 Introduction
Silverlight UK User Group #10 Introduction
Designer-Developer Interaction
PRISM and Silverlight
SilverlightPulse.NET [Silverlight UK User Group]
Ad

Recently uploaded (20)

PDF
A review of recent deep learning applications in wood surface defect identifi...
PDF
Convolutional neural network based encoder-decoder for efficient real-time ob...
PDF
sbt 2.0: go big (Scala Days 2025 edition)
PDF
How IoT Sensor Integration in 2025 is Transforming Industries Worldwide
PDF
CloudStack 4.21: First Look Webinar slides
PPTX
2018-HIPAA-Renewal-Training for executives
PPTX
Modernising the Digital Integration Hub
PDF
Five Habits of High-Impact Board Members
PDF
Comparative analysis of machine learning models for fake news detection in so...
PPTX
Benefits of Physical activity for teenagers.pptx
PDF
OpenACC and Open Hackathons Monthly Highlights July 2025
PDF
Getting started with AI Agents and Multi-Agent Systems
PPTX
AI IN MARKETING- PRESENTED BY ANWAR KABIR 1st June 2025.pptx
PPTX
MicrosoftCybserSecurityReferenceArchitecture-April-2025.pptx
PDF
A proposed approach for plagiarism detection in Myanmar Unicode text
PDF
“A New Era of 3D Sensing: Transforming Industries and Creating Opportunities,...
PPT
Galois Field Theory of Risk: A Perspective, Protocol, and Mathematical Backgr...
PPTX
TEXTILE technology diploma scope and career opportunities
PDF
Taming the Chaos: How to Turn Unstructured Data into Decisions
PPT
What is a Computer? Input Devices /output devices
A review of recent deep learning applications in wood surface defect identifi...
Convolutional neural network based encoder-decoder for efficient real-time ob...
sbt 2.0: go big (Scala Days 2025 edition)
How IoT Sensor Integration in 2025 is Transforming Industries Worldwide
CloudStack 4.21: First Look Webinar slides
2018-HIPAA-Renewal-Training for executives
Modernising the Digital Integration Hub
Five Habits of High-Impact Board Members
Comparative analysis of machine learning models for fake news detection in so...
Benefits of Physical activity for teenagers.pptx
OpenACC and Open Hackathons Monthly Highlights July 2025
Getting started with AI Agents and Multi-Agent Systems
AI IN MARKETING- PRESENTED BY ANWAR KABIR 1st June 2025.pptx
MicrosoftCybserSecurityReferenceArchitecture-April-2025.pptx
A proposed approach for plagiarism detection in Myanmar Unicode text
“A New Era of 3D Sensing: Transforming Industries and Creating Opportunities,...
Galois Field Theory of Risk: A Perspective, Protocol, and Mathematical Backgr...
TEXTILE technology diploma scope and career opportunities
Taming the Chaos: How to Turn Unstructured Data into Decisions
What is a Computer? Input Devices /output devices

MEF in Silverlight 4 - a guided tour