Crystal MEF

Phil Pursglove
Phil PursgloveSoftware Developer at WSP Group
Crystal MEF
Software is Hard 
• Components
• Extensibility
– IDTExtensibility2
– ASP.NET Providers
– System.AddIn
Managed Extensibility Framework
• Released under .NET 4.0
– System.ComponentModel.Composition
• Open source
– http://mef.codeplex.com
• DEMOS
4(½) Key Concepts
• Parts
– A component that does something
• Export
– Parts that are available to be consumed
• Import
– Parts that a program consumes
• Composition
– The process by which Imports and Exports are
mated together
1. Parts
• A type annotated with MEF metadata
2. Export
• [Export] on a class exposes it as a Part
[Export]
public class Logger()
…
• [Export(type)] can expose a specific type e.g.
an interface
[Export(typeof(ILogger)
public class Logger :Ilogger
• [Export(string)] can expose a named
contract
3. Import
• [Import(type)] on a property makes it
consume a Part
public class SomeClass
[Import(typeof(Ilogger))
private Ilogger MyLogger()
• [ImportMany()] allows a part to import a
collection (IEnumerable<T>) of parts
4. Composition
• Parts are loaded through Catalogs
– TypeCatalog
• IEnumerable<types>
• [types]
– AssemblyCatalog
– DirectoryCatalog
– Your custom implementation of a catalog e.g.
DatabaseCatalog, DownloadCatalog
½. Recomposition
• Dynamic composition in response to a change
in the number of available Parts
MEF Help
• No book 
• http://tinyurl.com/stackoverflowmef
• Twitter
– @gblock
– @kathleendollard
– #MEF
1 of 10

Recommended

CNIT 126 Ch 11: Malware Behavior by
CNIT 126 Ch 11: Malware BehaviorCNIT 126 Ch 11: Malware Behavior
CNIT 126 Ch 11: Malware BehaviorSam Bowne
294 views64 slides
Remembering Amber by
Remembering  AmberRemembering  Amber
Remembering AmberHolly.Cairell
283 views73 slides
The Need For Speed - NxtGen Cambridge by
The Need For Speed - NxtGen CambridgeThe Need For Speed - NxtGen Cambridge
The Need For Speed - NxtGen CambridgePhil Pursglove
413 views19 slides
Tweet reach its_k_isabella by
Tweet reach its_k_isabellaTweet reach its_k_isabella
Tweet reach its_k_isabellaMatthew Gain
2.4K views100 slides
Twitter and the Australian Election 2010 by
Twitter and the Australian Election 2010Twitter and the Australian Election 2010
Twitter and the Australian Election 2010Matthew Gain
796 views11 slides
The Need For Speed - NEBytes by
The Need For Speed - NEBytesThe Need For Speed - NEBytes
The Need For Speed - NEBytesPhil Pursglove
335 views17 slides

More Related Content

Similar to Crystal MEF

Eclipse plug in development by
Eclipse plug in developmentEclipse plug in development
Eclipse plug in developmentMartin Toshev
2.1K views55 slides
Extending the Enterprise with MEF by
Extending the Enterprise with MEFExtending the Enterprise with MEF
Extending the Enterprise with MEFBrian Ritchie
1.9K views24 slides
Building modular software with OSGi - Ulf Fildebrandt by
Building modular software with OSGi - Ulf FildebrandtBuilding modular software with OSGi - Ulf Fildebrandt
Building modular software with OSGi - Ulf Fildebrandtmfrancis
3.2K views53 slides
Building extensible application using MEF by
Building extensible application using MEFBuilding extensible application using MEF
Building extensible application using MEFRonak Thakkar
871 views16 slides
Managed extensibility framework by
Managed extensibility frameworkManaged extensibility framework
Managed extensibility frameworkLarry Nung
1.3K views31 slides
MEF Deep Dive by Piotr Wlodek by
MEF Deep Dive by Piotr WlodekMEF Deep Dive by Piotr Wlodek
MEF Deep Dive by Piotr Wlodekinfusiondev
1.9K views47 slides

Similar to Crystal MEF(20)

Eclipse plug in development by Martin Toshev
Eclipse plug in developmentEclipse plug in development
Eclipse plug in development
Martin Toshev2.1K views
Extending the Enterprise with MEF by Brian Ritchie
Extending the Enterprise with MEFExtending the Enterprise with MEF
Extending the Enterprise with MEF
Brian Ritchie1.9K views
Building modular software with OSGi - Ulf Fildebrandt by mfrancis
Building modular software with OSGi - Ulf FildebrandtBuilding modular software with OSGi - Ulf Fildebrandt
Building modular software with OSGi - Ulf Fildebrandt
mfrancis3.2K views
Building extensible application using MEF by Ronak Thakkar
Building extensible application using MEFBuilding extensible application using MEF
Building extensible application using MEF
Ronak Thakkar871 views
Managed extensibility framework by Larry Nung
Managed extensibility frameworkManaged extensibility framework
Managed extensibility framework
Larry Nung1.3K views
MEF Deep Dive by Piotr Wlodek by infusiondev
MEF Deep Dive by Piotr WlodekMEF Deep Dive by Piotr Wlodek
MEF Deep Dive by Piotr Wlodek
infusiondev1.9K views
Eclipse IDE Yocto Plugin by cudma
Eclipse IDE Yocto PluginEclipse IDE Yocto Plugin
Eclipse IDE Yocto Plugin
cudma4.4K views
Introduction to ,NET Framework by ANURAG SINGH
Introduction to ,NET FrameworkIntroduction to ,NET Framework
Introduction to ,NET Framework
ANURAG SINGH306 views
Pcom xpcom by Jay Patel
Pcom xpcomPcom xpcom
Pcom xpcom
Jay Patel478 views
Managed Extensibility Framework or Effective Development of Scalable Applicat... by SoftServe
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...
SoftServe2K views
Whats new in CDT in Mars Release by Teodor Madan
Whats new in CDT in Mars ReleaseWhats new in CDT in Mars Release
Whats new in CDT in Mars Release
Teodor Madan353 views
Dotnet framework by Nitu Pandey
Dotnet frameworkDotnet framework
Dotnet framework
Nitu Pandey4.8K views
.Net programming with C# by NguynSang29
.Net programming with C#.Net programming with C#
.Net programming with C#
NguynSang29151 views
Live session 2 lightning web component by SmritiSharan1
Live session 2 lightning web componentLive session 2 lightning web component
Live session 2 lightning web component
SmritiSharan1318 views
AADL: Architecture Analysis and Design Language by Ivano Malavolta
AADL: Architecture Analysis and Design LanguageAADL: Architecture Analysis and Design Language
AADL: Architecture Analysis and Design Language
Ivano Malavolta4.2K views
openioc_scan - IOC scanner for memory forensics by Takahiro Haruyama
openioc_scan - IOC scanner for memory forensicsopenioc_scan - IOC scanner for memory forensics
openioc_scan - IOC scanner for memory forensics
Takahiro Haruyama5.4K views
Introduction to DL-BUILDER by ssuserc37b5e
Introduction to DL-BUILDERIntroduction to DL-BUILDER
Introduction to DL-BUILDER
ssuserc37b5e9 views

More from Phil Pursglove

CosmosDb for beginners by
CosmosDb for beginnersCosmosDb for beginners
CosmosDb for beginnersPhil Pursglove
444 views9 slides
Glimpse by
GlimpseGlimpse
GlimpsePhil Pursglove
3.7K views7 slides
The Need for Speed - EpiCenter 2010 by
The Need for Speed - EpiCenter 2010The Need for Speed - EpiCenter 2010
The Need for Speed - EpiCenter 2010Phil Pursglove
450 views16 slides
Velocity - Edge UG by
Velocity - Edge UGVelocity - Edge UG
Velocity - Edge UGPhil Pursglove
377 views16 slides
Innovation at WSP by
Innovation at WSPInnovation at WSP
Innovation at WSPPhil Pursglove
250 views7 slides
Velocity - NxtGen Oxford by
Velocity - NxtGen OxfordVelocity - NxtGen Oxford
Velocity - NxtGen OxfordPhil Pursglove
303 views15 slides

More from Phil Pursglove(10)

Recently uploaded

Keynote Talk: Open Source is Not Dead - Charles Schulz - Vates by
Keynote Talk: Open Source is Not Dead - Charles Schulz - VatesKeynote Talk: Open Source is Not Dead - Charles Schulz - Vates
Keynote Talk: Open Source is Not Dead - Charles Schulz - VatesShapeBlue
252 views15 slides
Generative AI: Shifting the AI Landscape by
Generative AI: Shifting the AI LandscapeGenerative AI: Shifting the AI Landscape
Generative AI: Shifting the AI LandscapeDeakin University
53 views55 slides
"Surviving highload with Node.js", Andrii Shumada by
"Surviving highload with Node.js", Andrii Shumada "Surviving highload with Node.js", Andrii Shumada
"Surviving highload with Node.js", Andrii Shumada Fwdays
56 views29 slides
Confidence in CloudStack - Aron Wagner, Nathan Gleason - Americ by
Confidence in CloudStack - Aron Wagner, Nathan Gleason - AmericConfidence in CloudStack - Aron Wagner, Nathan Gleason - Americ
Confidence in CloudStack - Aron Wagner, Nathan Gleason - AmericShapeBlue
130 views9 slides
iSAQB Software Architecture Gathering 2023: How Process Orchestration Increas... by
iSAQB Software Architecture Gathering 2023: How Process Orchestration Increas...iSAQB Software Architecture Gathering 2023: How Process Orchestration Increas...
iSAQB Software Architecture Gathering 2023: How Process Orchestration Increas...Bernd Ruecker
54 views69 slides
Business Analyst Series 2023 - Week 4 Session 8 by
Business Analyst Series 2023 -  Week 4 Session 8Business Analyst Series 2023 -  Week 4 Session 8
Business Analyst Series 2023 - Week 4 Session 8DianaGray10
123 views13 slides

Recently uploaded(20)

Keynote Talk: Open Source is Not Dead - Charles Schulz - Vates by ShapeBlue
Keynote Talk: Open Source is Not Dead - Charles Schulz - VatesKeynote Talk: Open Source is Not Dead - Charles Schulz - Vates
Keynote Talk: Open Source is Not Dead - Charles Schulz - Vates
ShapeBlue252 views
"Surviving highload with Node.js", Andrii Shumada by Fwdays
"Surviving highload with Node.js", Andrii Shumada "Surviving highload with Node.js", Andrii Shumada
"Surviving highload with Node.js", Andrii Shumada
Fwdays56 views
Confidence in CloudStack - Aron Wagner, Nathan Gleason - Americ by ShapeBlue
Confidence in CloudStack - Aron Wagner, Nathan Gleason - AmericConfidence in CloudStack - Aron Wagner, Nathan Gleason - Americ
Confidence in CloudStack - Aron Wagner, Nathan Gleason - Americ
ShapeBlue130 views
iSAQB Software Architecture Gathering 2023: How Process Orchestration Increas... by Bernd Ruecker
iSAQB Software Architecture Gathering 2023: How Process Orchestration Increas...iSAQB Software Architecture Gathering 2023: How Process Orchestration Increas...
iSAQB Software Architecture Gathering 2023: How Process Orchestration Increas...
Bernd Ruecker54 views
Business Analyst Series 2023 - Week 4 Session 8 by DianaGray10
Business Analyst Series 2023 -  Week 4 Session 8Business Analyst Series 2023 -  Week 4 Session 8
Business Analyst Series 2023 - Week 4 Session 8
DianaGray10123 views
Backup and Disaster Recovery with CloudStack and StorPool - Workshop - Venko ... by ShapeBlue
Backup and Disaster Recovery with CloudStack and StorPool - Workshop - Venko ...Backup and Disaster Recovery with CloudStack and StorPool - Workshop - Venko ...
Backup and Disaster Recovery with CloudStack and StorPool - Workshop - Venko ...
ShapeBlue184 views
GDG Cloud Southlake 28 Brad Taylor and Shawn Augenstein Old Problems in the N... by James Anderson
GDG Cloud Southlake 28 Brad Taylor and Shawn Augenstein Old Problems in the N...GDG Cloud Southlake 28 Brad Taylor and Shawn Augenstein Old Problems in the N...
GDG Cloud Southlake 28 Brad Taylor and Shawn Augenstein Old Problems in the N...
James Anderson160 views
Extending KVM Host HA for Non-NFS Storage - Alex Ivanov - StorPool by ShapeBlue
Extending KVM Host HA for Non-NFS Storage -  Alex Ivanov - StorPoolExtending KVM Host HA for Non-NFS Storage -  Alex Ivanov - StorPool
Extending KVM Host HA for Non-NFS Storage - Alex Ivanov - StorPool
ShapeBlue123 views
Future of AR - Facebook Presentation by Rob McCarty
Future of AR - Facebook PresentationFuture of AR - Facebook Presentation
Future of AR - Facebook Presentation
Rob McCarty64 views
Centralized Logging Feature in CloudStack using ELK and Grafana - Kiran Chava... by ShapeBlue
Centralized Logging Feature in CloudStack using ELK and Grafana - Kiran Chava...Centralized Logging Feature in CloudStack using ELK and Grafana - Kiran Chava...
Centralized Logging Feature in CloudStack using ELK and Grafana - Kiran Chava...
ShapeBlue145 views
Mitigating Common CloudStack Instance Deployment Failures - Jithin Raju - Sha... by ShapeBlue
Mitigating Common CloudStack Instance Deployment Failures - Jithin Raju - Sha...Mitigating Common CloudStack Instance Deployment Failures - Jithin Raju - Sha...
Mitigating Common CloudStack Instance Deployment Failures - Jithin Raju - Sha...
ShapeBlue180 views
Zero to Cloud Hero: Crafting a Private Cloud from Scratch with XCP-ng, Xen Or... by ShapeBlue
Zero to Cloud Hero: Crafting a Private Cloud from Scratch with XCP-ng, Xen Or...Zero to Cloud Hero: Crafting a Private Cloud from Scratch with XCP-ng, Xen Or...
Zero to Cloud Hero: Crafting a Private Cloud from Scratch with XCP-ng, Xen Or...
ShapeBlue198 views
DRBD Deep Dive - Philipp Reisner - LINBIT by ShapeBlue
DRBD Deep Dive - Philipp Reisner - LINBITDRBD Deep Dive - Philipp Reisner - LINBIT
DRBD Deep Dive - Philipp Reisner - LINBIT
ShapeBlue180 views
2FA and OAuth2 in CloudStack - Andrija Panić - ShapeBlue by ShapeBlue
2FA and OAuth2 in CloudStack - Andrija Panić - ShapeBlue2FA and OAuth2 in CloudStack - Andrija Panić - ShapeBlue
2FA and OAuth2 in CloudStack - Andrija Panić - ShapeBlue
ShapeBlue147 views
Import Export Virtual Machine for KVM Hypervisor - Ayush Pandey - University ... by ShapeBlue
Import Export Virtual Machine for KVM Hypervisor - Ayush Pandey - University ...Import Export Virtual Machine for KVM Hypervisor - Ayush Pandey - University ...
Import Export Virtual Machine for KVM Hypervisor - Ayush Pandey - University ...
ShapeBlue119 views
Migrating VMware Infra to KVM Using CloudStack - Nicolas Vazquez - ShapeBlue by ShapeBlue
Migrating VMware Infra to KVM Using CloudStack - Nicolas Vazquez - ShapeBlueMigrating VMware Infra to KVM Using CloudStack - Nicolas Vazquez - ShapeBlue
Migrating VMware Infra to KVM Using CloudStack - Nicolas Vazquez - ShapeBlue
ShapeBlue218 views
Elevating Privacy and Security in CloudStack - Boris Stoyanov - ShapeBlue by ShapeBlue
Elevating Privacy and Security in CloudStack - Boris Stoyanov - ShapeBlueElevating Privacy and Security in CloudStack - Boris Stoyanov - ShapeBlue
Elevating Privacy and Security in CloudStack - Boris Stoyanov - ShapeBlue
ShapeBlue222 views

Crystal MEF

  • 2. Software is Hard  • Components • Extensibility – IDTExtensibility2 – ASP.NET Providers – System.AddIn
  • 3. Managed Extensibility Framework • Released under .NET 4.0 – System.ComponentModel.Composition • Open source – http://mef.codeplex.com • DEMOS
  • 4. 4(½) Key Concepts • Parts – A component that does something • Export – Parts that are available to be consumed • Import – Parts that a program consumes • Composition – The process by which Imports and Exports are mated together
  • 5. 1. Parts • A type annotated with MEF metadata
  • 6. 2. Export • [Export] on a class exposes it as a Part [Export] public class Logger() … • [Export(type)] can expose a specific type e.g. an interface [Export(typeof(ILogger) public class Logger :Ilogger • [Export(string)] can expose a named contract
  • 7. 3. Import • [Import(type)] on a property makes it consume a Part public class SomeClass [Import(typeof(Ilogger)) private Ilogger MyLogger() • [ImportMany()] allows a part to import a collection (IEnumerable<T>) of parts
  • 8. 4. Composition • Parts are loaded through Catalogs – TypeCatalog • IEnumerable<types> • [types] – AssemblyCatalog – DirectoryCatalog – Your custom implementation of a catalog e.g. DatabaseCatalog, DownloadCatalog
  • 9. ½. Recomposition • Dynamic composition in response to a change in the number of available Parts
  • 10. MEF Help • No book  • http://tinyurl.com/stackoverflowmef • Twitter – @gblock – @kathleendollard – #MEF