MEF

1,039 views

Published on

This is a presentation about MEF (Managed Extensibility Framework). Here you can get quick overview

Published in: Education, Technology, Business
0 Comments
3 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
1,039
On SlideShare
0
From Embeds
0
Number of Embeds
5
Actions
Shares
0
Downloads
27
Comments
0
Likes
3
Embeds 0
No embeds

No notes for slide

MEF

  1. 1. How to… Yuriy Seniuk http://yuriyseniuk.blogspot.com/
  2. 2.  Managed Extensibility Framework  Open Source
  3. 3.  Makes extensible your Apps  Speed-up!
  4. 4.  Think of the task  Declare Export  Declare Import  Compose Both together
  5. 5.  [System.ComponentModel.Composition.ExportAttribute]  [Export]  public class Plugin1{...}  [Export(typeof(Plugin2))]  public class Plugin2 {...}  [Export(“MitaTeknik.Plugin")]  public class Plugin3 {...}  [Export(typeof(IPlugin))]  public class Plugin4: IPlugin{…}
  6. 6.  [System.ComponentModel.Composition.ImportAttribute]  [Import]  public Plugin1 Plugin {get ;set; }  [Import(typeof(Plugin2))]  public Plugin2 Plugin2 {get ;set; }}  [Import(“MitaTeknik.Plugin")]  public Plugin3 Plugin {get ;set; }  [Import(typeof(IPlugin))]  public IPlugin Plugin4 {get ;set; }
  7. 7.  [System.ComponentModel.Composition.Hosting.AssemblyCatalog]  var catalog = new AssemblyCatalog(“Assembly”);  var catalog = new DirectoryCatalog(“Extensions");  var catalog = new AggregateCatalog( new AssemblyCatalog(“Assembly”), new DirectoryCatalog("Extensions"));  var container = new CompositionContainer(catalog);  var batch = new CompositionBatch(); batch.AddPart( this ); container.Compose(batch);
  8. 8.  http://mef.codeplex.com/  http://channel9.msdn.com/shows/SilverlightTV/Silverlight-TV-7-When- and-Where-to-use-MEF/  http://channel9.msdn.com/shows/SilverlightTV/Silverlight-TV-Episode-4- 3-Steps-to-MEF-Export-Import-Compose/  http://channel9.msdn.com/shows/SilverlightTV/Silverlight-TV-Episode-5- Using-Metadata-with-MEF/

×