Mef 12 step program

1,946 views

Published on

My introductory presentation about using MEF, the Managed Extensibility Framework in .Net

0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
1,946
On SlideShare
0
From Embeds
0
Number of Embeds
550
Actions
Shares
0
Downloads
14
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

Mef 12 step program

  1. 1. Getting Addicted to MEF A 12 Step Program To Become Addicted to Awesomeness
  2. 2. Step 1: Admitting <ul><li>James Eggers </li></ul><ul><li>From Kansas City </li></ul><ul><li>Addicted for about a Year </li></ul><ul><li>Talk about it on Twitter and my blog. </li></ul><ul><li>Find Odd Situations to Use It More. </li></ul>
  3. 3. MEF? <ul><li>Managed Extensibility Framework </li></ul><ul><li>A framework to simplify building internally and externally compose-able applications </li></ul><ul><li>Could possibly become the “LINQ” of .Net 4 </li></ul>
  4. 4. Current Issues in Extensibility <ul><li>Limited Documentation </li></ul><ul><li>Complex APIs </li></ul><ul><li>Reflection </li></ul><ul><li>Large Inheritance Chains </li></ul><ul><li>Difficult to Estimate </li></ul>
  5. 5. Step 2: Giving In <ul><li>Easy To Use </li></ul><ul><li>Easy To Learn </li></ul><ul><li>Auto-Composition </li></ul><ul><li>Metadata </li></ul><ul><li>Custom Contracts </li></ul><ul><li>Open Source </li></ul><ul><li>Auto-Discovery </li></ul><ul><li>Extensible </li></ul>
  6. 6. Step 3: Where to Find MEF <ul><li>Codeplex http://mef.codeplex.com </li></ul><ul><li>.Net Framework 4 </li></ul>
  7. 7. Step 4: Identifying Items
  8. 8. Step 5: Observing the Addition
  9. 9. Step 6: Understanding - Exports <ul><li>Extensions To Be Consumed </li></ul><ul><li>Export & InheritedExport Attributes </li></ul><ul><li>PartNotDiscoverable Attr. </li></ul><ul><li>Different Objects: </li></ul><ul><ul><li>Properties </li></ul></ul><ul><ul><li>Methods </li></ul></ul><ul><ul><li>Classes </li></ul></ul>
  10. 10. Step 6: Understanding - Imports <ul><li>Consumers </li></ul><ul><li>Extensibility Points </li></ul><ul><li>Import Attribute </li></ul><ul><li>ImportMany Attribute </li></ul><ul><li>Different Objects: </li></ul><ul><ul><li>Properties </li></ul></ul><ul><ul><li>Fields </li></ul></ul><ul><ul><li>Constructor Params </li></ul></ul>
  11. 11. Step 6: Understanding - Catalogs <ul><li>Discovers and Instantiates Exports </li></ul><ul><li>Used by Containers </li></ul><ul><li>Multiple Types </li></ul><ul><ul><li>TypeCatalog </li></ul></ul><ul><ul><li>AssemblyCatalog </li></ul></ul><ul><ul><li>DirectoryCatalog </li></ul></ul><ul><ul><li>AggregateCatalog </li></ul></ul>
  12. 12. Step 7: Observing Further
  13. 13. Step 8: Sharing Information <ul><li>Metadata </li></ul><ul><ul><li>Used to provide extra information </li></ul></ul><ul><ul><li>Lazy Instantiation </li></ul></ul><ul><ul><li>ExportMetadata Attr. </li></ul></ul><ul><ul><li>Demo </li></ul></ul>
  14. 14. Step 9: Sharing Experiences <ul><li>Lessons Learned </li></ul><ul><ul><li>InheritedExport can cause hide metadata </li></ul></ul><ul><ul><li>ImportMany to IList<T> has to be instantiated before composition </li></ul></ul><ul><ul><li>PartNotDiscoverable Attribute doesn't work with TypeCatalogs </li></ul></ul>
  15. 15. Step 9: Sharing Experiences <ul><li>Lessons Learned(cont) </li></ul><ul><ul><li>Stable Composition Can Lead to a lot of Drinking Debugging. </li></ul></ul><ul><ul><li>Directory Catalog can load multiples if 2 assemblies are found with the same type in said directory. </li></ul></ul><ul><ul><li>Directory Catalog does not look at child directories. </li></ul></ul><ul><ul><li>GetCallingAssembly() is great for unit testing part imports. </li></ul></ul>
  16. 16. Step 10: Identifying Opportunities <ul><li>IoC Container </li></ul><ul><li>MVC Controller Factory </li></ul><ul><li>“ Flashcard” style programs </li></ul><ul><li>Rules Engines </li></ul><ul><li>App Themes </li></ul><ul><li>Workflow Steps </li></ul><ul><li>Many More </li></ul>
  17. 17. Step 11: Practical Observation
  18. 18. Step 12: Continuing Education <ul><li>Codeplex - http://mef.codeplex.com </li></ul><ul><li>MSDN - http://msdn.microsoft.com </li></ul><ul><li>My Blog - http://RandomActsOfCoding.Blogspot.Com </li></ul><ul><li>MEF Contrib - http://mefcontrib.codeplex.com </li></ul>
  19. 19. My Information <ul><li>James Eggers </li></ul><ul><li>Email - [email_address] </li></ul><ul><li>Blog - http://RandomActsOfCoding.Blogspot.Com </li></ul><ul><li>Twitter - @JamesEggers </li></ul>

×