SlideShare a Scribd company logo
1 of 22
MEF in Silverlight 4 – a guided tour Mike Taulty Microsoft Ltd mtaulty@microsoft.com mtaulty.com twitter.com/mtaulty
[background]
MEF – What is it? How do I get it? the Managed Extensibility Framework an 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 2010 Silverlight 3 & .NET Framework V3.5 Sp1 Source on CodePlex
“scenario” iTunesMediaPlayer Constructor() GetAlbumInfo(“Blood on the Tracks”) IAlbumInfoProvider AlbumInfoProvider Constructor() GetAlbumArt(“Blood on the Tracks”) IAlbumArtProvider AlbumArtProvider
“scenario” iTunesMediaPlayer Constructor() GetAlbumInfo(“Blood on the Tracks”) AlbumInfoProvider Constructor() GetAlbumArt(“Blood on the Tracks”) AlbumArtProvider ,[object Object]
Hard to test AlbumInfoProvider in isolation from AlbumArtProvider
Hard to drop in a different AlbumArtProvider implementation
Code changes to AlbumArtProvider impact AlbumInfoProvider,[object Object]
Easier to test AlbumInfoProvider with anyIAlbumArtProvider
Easier to drop in new implementations of IAlbumArtProvider
Version changes to AlbumArtProvider do not impact AlbumInfoProvider,[object Object]
the IoC Container Container iTunesMediaPlayer Get<IAlbumInfoProvider>() AlbumArtProvider AlbumArtProvider Constructor(IAlbumArtProvider) Constructor(IAlbumArtProvider) AlbumInfoProvider AlbumInfoProvider
[end of background]
example ( Unity IoC )
but MEF is not ‘just’ another IoC container an extensible framework for composing applications from a set of loosely-coupled parts discovered and evolving at run-time
using MEF in our scenario demo
MEF models composable parts import import import Part export export
MEF composes parts import import import import import import import part part part part import import export export export Composition Engine export part part part part part
which parts compose together? import import import part export export ? import part
matching imports to exports demo
parts & part definitions import import import import Part PartDefinition CreatePart() export export export PartDefinition is a blueprint for a Part similar to Object and Type in .NET but can have Part without PartDefinition
container draws parts from catalogs PartDefinition PartDefinition PartDefinition PartDefinition PartDefinition PartDefinition PartDefinition PartDefinition PartDefinition import import import PartDefinition import import import PartDefinition import import import PartDefinition Part Part Part Catalog Catalog Catalog export export export export export export Catalog CompositionContainer

More Related Content

Similar to MEF in Silverlight 4 - a guided tour

Managed Extensibility Framework or Effective Development of Scalable Applicat...
Managed Extensibility Framework or Effective Development of Scalable Applicat...Managed Extensibility Framework or Effective Development of Scalable Applicat...
Managed Extensibility Framework or Effective Development of Scalable Applicat...
SoftServe
 
Mike Taulty Beyond Silverlight With W P F
Mike Taulty  Beyond  Silverlight  With  W P FMike Taulty  Beyond  Silverlight  With  W P F
Mike Taulty Beyond Silverlight With W P F
ukdpe
 
MEF Deep Dive by Piotr Wlodek
MEF Deep Dive by Piotr WlodekMEF Deep Dive by Piotr Wlodek
MEF Deep Dive by Piotr Wlodek
infusiondev
 
Lap around .net 4
Lap around .net 4Lap around .net 4
Lap around .net 4
Abdul Khan
 
Railo Presentation Railo 3.1
Railo Presentation Railo 3.1Railo Presentation Railo 3.1
Railo Presentation Railo 3.1
Rhinofly
 

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

Managed Extensibility Framework or Effective Development of Scalable Applicat...
Managed Extensibility Framework or Effective Development of Scalable Applicat...Managed Extensibility Framework or Effective Development of Scalable Applicat...
Managed Extensibility Framework or Effective Development of Scalable Applicat...
 
Managed Extensibility Framework
Managed Extensibility FrameworkManaged Extensibility Framework
Managed Extensibility Framework
 
Mike Taulty Beyond Silverlight With W P F
Mike Taulty  Beyond  Silverlight  With  W P FMike Taulty  Beyond  Silverlight  With  W P F
Mike Taulty Beyond Silverlight With W P F
 
Extending the Enterprise with MEF
Extending the Enterprise with MEFExtending the Enterprise with MEF
Extending the Enterprise with MEF
 
What's New for Presentation in Visual Studio 2008 SP1
What's New for Presentation in Visual Studio 2008 SP1What's New for Presentation in Visual Studio 2008 SP1
What's New for Presentation in Visual Studio 2008 SP1
 
MEF Deep Dive by Piotr Wlodek
MEF Deep Dive by Piotr WlodekMEF Deep Dive by Piotr Wlodek
MEF Deep Dive by Piotr Wlodek
 
Plug yourself in and your app will never be the same (2 hr editon)
Plug yourself in and your app will never be the same (2 hr editon)Plug yourself in and your app will never be the same (2 hr editon)
Plug yourself in and your app will never be the same (2 hr editon)
 
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 hour edition)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 hour edition)
 
All the Laravel things: up and running to making $$
All the Laravel things: up and running to making $$All the Laravel things: up and running to making $$
All the Laravel things: up and running to making $$
 
VMware Studio & vAPP-s
VMware Studio & vAPP-sVMware Studio & vAPP-s
VMware Studio & vAPP-s
 
​Abinitio online training
​Abinitio online training​Abinitio online training
​Abinitio online training
 
IoT Seminar (Oct. 2016) Alex Edelmann - Bosch Singapore
IoT Seminar (Oct. 2016) Alex Edelmann - Bosch SingaporeIoT Seminar (Oct. 2016) Alex Edelmann - Bosch Singapore
IoT Seminar (Oct. 2016) Alex Edelmann - Bosch Singapore
 
Reusando componentes Zope fuera de Zope
Reusando componentes Zope fuera de ZopeReusando componentes Zope fuera de Zope
Reusando componentes Zope fuera de Zope
 
Lap around .net 4
Lap around .net 4Lap around .net 4
Lap around .net 4
 
Adobe is from Mars, Microsoft is from Uranus. A look at two competing web st...
Adobe is from Mars, Microsoft is from Uranus.  A look at two competing web st...Adobe is from Mars, Microsoft is from Uranus.  A look at two competing web st...
Adobe is from Mars, Microsoft is from Uranus. A look at two competing web st...
 
SynapseIndia dotnet development framework
SynapseIndia  dotnet development frameworkSynapseIndia  dotnet development framework
SynapseIndia dotnet development framework
 
Power Apps Component Framework - Dynamics Power! 365 Paris 2019
Power Apps Component Framework - Dynamics Power! 365 Paris 2019  Power Apps Component Framework - Dynamics Power! 365 Paris 2019
Power Apps Component Framework - Dynamics Power! 365 Paris 2019
 
java swing programming
java swing programming java swing programming
java swing programming
 
Railo Presentation Railo 3.1
Railo Presentation Railo 3.1Railo Presentation Railo 3.1
Railo Presentation Railo 3.1
 
Migrate To Lightning Web Components from Aura framework to increase performance
Migrate To Lightning Web Components from Aura framework to increase performance Migrate To Lightning Web Components from Aura framework to increase performance
Migrate To Lightning Web Components from Aura framework to increase performance
 

More from mark mann

More from mark mann (11)

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

Recently uploaded

Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
vu2urc
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 

Recently uploaded (20)

Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 

MEF in Silverlight 4 - a guided tour

  • 1. MEF in Silverlight 4 – a guided tour Mike Taulty Microsoft Ltd mtaulty@microsoft.com mtaulty.com twitter.com/mtaulty
  • 3. MEF – What is it? How do I get it? the Managed Extensibility Framework an 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 2010 Silverlight 3 & .NET Framework V3.5 Sp1 Source on CodePlex
  • 4. “scenario” iTunesMediaPlayer Constructor() GetAlbumInfo(“Blood on the Tracks”) IAlbumInfoProvider AlbumInfoProvider Constructor() GetAlbumArt(“Blood on the Tracks”) IAlbumArtProvider AlbumArtProvider
  • 5.
  • 6. Hard to test AlbumInfoProvider in isolation from AlbumArtProvider
  • 7. Hard to drop in a different AlbumArtProvider implementation
  • 8.
  • 9. Easier to test AlbumInfoProvider with anyIAlbumArtProvider
  • 10. Easier to drop in new implementations of IAlbumArtProvider
  • 11.
  • 12. the IoC Container Container iTunesMediaPlayer Get<IAlbumInfoProvider>() AlbumArtProvider AlbumArtProvider Constructor(IAlbumArtProvider) Constructor(IAlbumArtProvider) AlbumInfoProvider AlbumInfoProvider
  • 15. but MEF is not ‘just’ another IoC container an extensible framework for composing applications from a set of loosely-coupled parts discovered and evolving at run-time
  • 16. using MEF in our scenario demo
  • 17. MEF models composable parts import import import Part export export
  • 18. MEF composes parts import import import import import import import part part part part import import export export export Composition Engine export part part part part part
  • 19. which parts compose together? import import import part export export ? import part
  • 20. matching imports to exports demo
  • 21. parts & part definitions import import import import Part PartDefinition CreatePart() export export export PartDefinition is a blueprint for a Part similar to Object and Type in .NET but can have Part without PartDefinition
  • 22. container draws parts from catalogs PartDefinition PartDefinition PartDefinition PartDefinition PartDefinition PartDefinition PartDefinition PartDefinition PartDefinition import import import PartDefinition import import import PartDefinition import import import PartDefinition Part Part Part Catalog Catalog Catalog export export export export export export Catalog CompositionContainer
  • 23. or mix in pre-instantiated parts part Imports(“Foo”) Compose() part Exports(“Foo”) CompositionContainer
  • 25. things change - recomposition New parts [introduced to/removed from] container may have an impact on this import – a part can opt-in to allow this recomposition part Compose() part? part CompositionContainer part Catalog Catalog Catalog PartDefinition PartDefinition PartDefinition PartDefinition Some catalogs support additions
  • 26. recomposition is key for Silverlight initial, small download MyApp.xap Extras.xap additional functionality
  • 27. recomposition & the DeploymentCatalog demo
  • 28. stable composition reject parts with unsatisfied imports reject changes that break existing “agreements” part part requires exactly one part requires part part requires CompositionContainer missing different part, same contract part
  • 30. MEF and Model View ViewModel Strong separation of concerns possible with Silverlight development user interface declared in XAML loosely binds to data functionality invoked by declarative commands Encapsulated by the “MVVM” pattern binding model (“data”) viewmodel (state & data for view) view (declarative XAML) commands
  • 31. MVVM via MEF demo
  • 32. resources Glenn Block blogs.msdn.com/gblock Nicholas Blumhardt blogs.msdn.com/nblumhardt MEF on CodePlex mef.codeplex.com Channel 9 Silverlight 4 MEF Screencasts channel9.msdn.com/tags/learnMEFSL4
  • 33. feedbackMicrosoft Session Feedback via Twitter @msftsession 10 @mtaulty #sluguk ... session score out of 10 ( 10 is recommended but other scores are possible )