SlideShare a Scribd company logo
MEF
Managed Extensibility Framework
Overview
• MEF is library for creating extensible applications. It allows applications to discover and use
components without no configuration required.
• MEF can also be used as IOC / DI container but its primarily designed with the goal of developing
extensible application.
• There are other IOC containers like Unity, Ninject, Autofac, Castle Windsor, StructureMap.
• IOC / Other frameworks can be used to achieve extensibility but
• They require too much development and configuration effort. Think of developing extensible application that can adapt to
runtime changes using Castle or Unity. MEF support this out of the Box with no configuration.
• Some of those frameworks are too heavyweight for simple programming model and not full featured.
Scenario
• You are developing a large application that needs support for extensibility. Other developers
should be able to extend your application by developing components.
• You want develop your application with loosely coupled plug-in based architecture like Visual
Studio, Microsoft Office, Firefox browser.
• Visual Studio is real world example using MEF to support extensibility.
• Key points
• Your application and components should be decoupled and independent.
• You application does not know about component at compile time. Application should be able to integrate / plugin those
components at runtime without need of rebuilding the application.
• Components does not have access to source code of your application but still can extend / add features to your application.
Application does not have access to component source code.
Without MEF and problems
• You develop main application.
• You develop components, include them as a source code in your main application solution, add
them as a reference in your main application and modify application to use them.
• Problems? Problems and Problems (Is your application extensible anymore?)
• Every time a component is developed / updated, main application source code needs to be changed to add reference to that
component and modify code to use that. Statically composed.
• Component developer does not have access to your code and your main application does not have access to component?
• Does Visual Studio and ReSharper extension know each other and have their source code. No. But they still work together.
MEF as a Solution
• Decoupling between application and components
• Statically compiled VS dynamically composed
• Known (at compile time) VS Unknown (Discovered at run time)
• Convert your app into Platform
How MEF works
Main Application
Import ILogger Catalog
Assemblies
Parts
Composition
Container
MEF
Part A MyLogger
Component
Export ILogger
Contract
ILogger
Key points
• Import
• Export
• Discover and Compose
Concepts
• Part: Part known as Export can provide services to other parts and parts known as Import can consume
services by other parts.
• Contract: Parts talk to each other using contract hence parts gets decoupled. Import part specifies
contract that it needs and Export part specifies contract that it provides.
• Import, ImportMany: Attribute applied on Part that creates need.
• Export: Attribute applied on Part that fulfills the need.
• Catalog: Knows where to find exported parts. Discover assemblies at run-time from plugins folder,
discover and load parts. Contains collection of exported parts.
• Compose: Exported and Imported parts are assembles together. Match the exported parts from the
assembly with the parts that want to import / use them
Programming Model
• Attribute based programming model
• Apply attributes to your classes, methods, properties, fields and constructor to determine how pieces are composed within
MEF
• Import -> Field, Property, Constructor
• Export -> Class, Method, Property, Field
• Convection based programming model
• Define set of rules that determines what is composed and what is not
Demo Application
MEF Features
Import
• Import
• ImportMany
• Import(AllowRecompsition = true)
• ImportingConstructor
• Lazy<T>
• IPartImportsSatisifiedNotification
Metadata support
• Code Samples
Catalog
• Type Catalog
• Assembly Catalog
• Directory Catalog
• Aggregate Catalog
MEF Re-composition
DirectoryCatalog
CompositionContainer
FileSystemWatcher
Watch for added / modified files
DirectoryCatalog.Refresh
to include added /
modifies assemblies
Issues
DirectoryCatalog.Refresh only works on added / removed assemblies and not updated
assemblies. When assembly is removed from folder, Refresh will only remove
ComposablePartDefination objects from catalog but does not unloaded assembly from
process.
Existing assemblies cannot be updated when main application has loaded those
assemblies. Use Shadow Copy to solve this problem.
Facts about MEF
• MEF is open source hosted on CodePlex
• MEF is lightweight (One DLL -> System.Composition.ComponentModel)
• MEF is already shipped with .Net framework
• MEF can be used with any .Net platform. WPF, Silverlight, ASP.NET MVC, WinForms
• MEF has 2 versions
• MEF that is already shipped with .Net Framework (System.Composition.ComponentModel)
• Lightweight version of MEF optimized for static composition scenarios and provides faster composition
Question and Answers

More Related Content

What's hot

Siebel Open UI Debugging (Siebel Open UI Training, Part 7)
Siebel Open UI Debugging (Siebel Open UI Training, Part 7)Siebel Open UI Debugging (Siebel Open UI Training, Part 7)
Siebel Open UI Debugging (Siebel Open UI Training, Part 7)
Tech OneStop
 
Building Eclipse Plugins
Building Eclipse PluginsBuilding Eclipse Plugins
Building Eclipse Plugins
Liran Zelkha
 
Reusable Build Scripts for Managed Package Development (October 14, 2014)
Reusable Build Scripts for Managed Package Development (October 14, 2014)Reusable Build Scripts for Managed Package Development (October 14, 2014)
Reusable Build Scripts for Managed Package Development (October 14, 2014)
Salesforce Partners
 
Lap around .net 4
Lap around .net 4Lap around .net 4
Lap around .net 4Abdul Khan
 
Introduction to Continuous Integration
Introduction to Continuous IntegrationIntroduction to Continuous Integration
Introduction to Continuous Integration
Hùng Nguyễn Huy
 
Selenium training course_content_3_days
Selenium training course_content_3_daysSelenium training course_content_3_days
Selenium training course_content_3_days
sayhi2sudarshan
 
Designing an effective hybrid apps automation framework
Designing an effective hybrid apps automation frameworkDesigning an effective hybrid apps automation framework
Designing an effective hybrid apps automation framework
Andrea Tino
 
Paragon New and Old Comparassion
Paragon New and Old ComparassionParagon New and Old Comparassion
Paragon New and Old Comparassion
Mark Flavin
 
Techniques and Tools to Improve the Salesforce Development Cycle
Techniques and Tools to Improve the Salesforce Development CycleTechniques and Tools to Improve the Salesforce Development Cycle
Techniques and Tools to Improve the Salesforce Development Cycle
Salesforce Developers
 
Selenium
SeleniumSelenium
Selenium
abiramimaya
 
How to commit a project in svn using svn plugin in anypoint studio
How to commit a project in svn using svn plugin in anypoint studioHow to commit a project in svn using svn plugin in anypoint studio
How to commit a project in svn using svn plugin in anypoint studio
Sudha Ch
 
Deployment automation framework with selenium
Deployment automation framework with seleniumDeployment automation framework with selenium
Deployment automation framework with selenium
Wenhua Wang
 
1. deploying an asp.net web application
1. deploying an asp.net web application1. deploying an asp.net web application
1. deploying an asp.net web application
Pramod Rathore
 
Top 10 php frameworks in 2021
Top 10 php frameworks in 2021Top 10 php frameworks in 2021
Top 10 php frameworks in 2021
MaryamAnwar10
 
ITU - MDD - Eclipse Plug-ins
ITU - MDD - Eclipse Plug-insITU - MDD - Eclipse Plug-ins
ITU - MDD - Eclipse Plug-ins
Tonny Madsen
 
Selenium Test Automation
Selenium Test AutomationSelenium Test Automation
Selenium Test Automation
BabuDevanandam
 
Mule Integration with Atlassian JIRA
Mule Integration with Atlassian JIRAMule Integration with Atlassian JIRA
Mule Integration with Atlassian JIRA
Ramakrishna Narkedamilli
 
Koala component model (1)
Koala component model (1)Koala component model (1)
Koala component model (1)Saransh Garg
 
UI5con 2017 - UI5 Components - More Performance...
UI5con 2017 - UI5 Components - More Performance...UI5con 2017 - UI5 Components - More Performance...
UI5con 2017 - UI5 Components - More Performance...
Peter Muessig
 

What's hot (20)

Siebel Open UI Debugging (Siebel Open UI Training, Part 7)
Siebel Open UI Debugging (Siebel Open UI Training, Part 7)Siebel Open UI Debugging (Siebel Open UI Training, Part 7)
Siebel Open UI Debugging (Siebel Open UI Training, Part 7)
 
Building Eclipse Plugins
Building Eclipse PluginsBuilding Eclipse Plugins
Building Eclipse Plugins
 
Reusable Build Scripts for Managed Package Development (October 14, 2014)
Reusable Build Scripts for Managed Package Development (October 14, 2014)Reusable Build Scripts for Managed Package Development (October 14, 2014)
Reusable Build Scripts for Managed Package Development (October 14, 2014)
 
Lap around .net 4
Lap around .net 4Lap around .net 4
Lap around .net 4
 
Introduction to Continuous Integration
Introduction to Continuous IntegrationIntroduction to Continuous Integration
Introduction to Continuous Integration
 
Selenium training course_content_3_days
Selenium training course_content_3_daysSelenium training course_content_3_days
Selenium training course_content_3_days
 
Designing an effective hybrid apps automation framework
Designing an effective hybrid apps automation frameworkDesigning an effective hybrid apps automation framework
Designing an effective hybrid apps automation framework
 
Paragon New and Old Comparassion
Paragon New and Old ComparassionParagon New and Old Comparassion
Paragon New and Old Comparassion
 
Techniques and Tools to Improve the Salesforce Development Cycle
Techniques and Tools to Improve the Salesforce Development CycleTechniques and Tools to Improve the Salesforce Development Cycle
Techniques and Tools to Improve the Salesforce Development Cycle
 
Selenium
SeleniumSelenium
Selenium
 
How to commit a project in svn using svn plugin in anypoint studio
How to commit a project in svn using svn plugin in anypoint studioHow to commit a project in svn using svn plugin in anypoint studio
How to commit a project in svn using svn plugin in anypoint studio
 
Deployment automation framework with selenium
Deployment automation framework with seleniumDeployment automation framework with selenium
Deployment automation framework with selenium
 
1. deploying an asp.net web application
1. deploying an asp.net web application1. deploying an asp.net web application
1. deploying an asp.net web application
 
Visual Studio 2010 RTMtoSP1
Visual Studio 2010 RTMtoSP1Visual Studio 2010 RTMtoSP1
Visual Studio 2010 RTMtoSP1
 
Top 10 php frameworks in 2021
Top 10 php frameworks in 2021Top 10 php frameworks in 2021
Top 10 php frameworks in 2021
 
ITU - MDD - Eclipse Plug-ins
ITU - MDD - Eclipse Plug-insITU - MDD - Eclipse Plug-ins
ITU - MDD - Eclipse Plug-ins
 
Selenium Test Automation
Selenium Test AutomationSelenium Test Automation
Selenium Test Automation
 
Mule Integration with Atlassian JIRA
Mule Integration with Atlassian JIRAMule Integration with Atlassian JIRA
Mule Integration with Atlassian JIRA
 
Koala component model (1)
Koala component model (1)Koala component model (1)
Koala component model (1)
 
UI5con 2017 - UI5 Components - More Performance...
UI5con 2017 - UI5 Components - More Performance...UI5con 2017 - UI5 Components - More Performance...
UI5con 2017 - UI5 Components - More Performance...
 

Similar to Building extensible application using MEF

Introduction to the Managed Extensibility Framework in Silverlight
Introduction to the Managed Extensibility Framework in SilverlightIntroduction to the Managed Extensibility Framework in Silverlight
Introduction to the Managed Extensibility Framework in Silverlight
Jeremy Likness
 
.net Based Component Technologies
.net Based Component Technologies.net Based Component Technologies
.net Based Component Technologies
prakashk453625
 
Adobe Flex - Developing Rich Internet Application Workshop Day 2
Adobe Flex - Developing Rich Internet Application Workshop Day 2Adobe Flex - Developing Rich Internet Application Workshop Day 2
Adobe Flex - Developing Rich Internet Application Workshop Day 2Shyamala Prayaga
 
Continuous Integration
Continuous IntegrationContinuous Integration
Continuous Integration
XPDays
 
Modular PHP Development using CodeIgniter Bonfire
Modular PHP Development using CodeIgniter BonfireModular PHP Development using CodeIgniter Bonfire
Modular PHP Development using CodeIgniter Bonfire
Jeff Fox
 
Siebel Open UI Presentation
Siebel Open UI PresentationSiebel Open UI Presentation
Siebel Open UI Presentation
Ajeeth Pingle
 
Top 5 react developer tools in 2021
 Top 5 react developer tools in 2021 Top 5 react developer tools in 2021
Top 5 react developer tools in 2021
BOSC Tech Labs
 
Cross Site Collection Navigation using SPFx, Powershell PnP & PnP-JS
Cross Site Collection Navigation using SPFx, Powershell PnP & PnP-JSCross Site Collection Navigation using SPFx, Powershell PnP & PnP-JS
Cross Site Collection Navigation using SPFx, Powershell PnP & PnP-JS
Thomas Daly
 
Using BladeRunnerJS to Build Front-End Apps that Scale - Fluent 2014
Using BladeRunnerJS to Build Front-End Apps that Scale - Fluent 2014Using BladeRunnerJS to Build Front-End Apps that Scale - Fluent 2014
Using BladeRunnerJS to Build Front-End Apps that Scale - Fluent 2014
Phil Leggetter
 
Managing OSS license obligations
Managing OSS license obligationsManaging OSS license obligations
Managing OSS license obligations
nexB Inc.
 
Top 7 react developer tools to use in 2021
Top 7 react developer tools to use in 2021Top 7 react developer tools to use in 2021
Top 7 react developer tools to use in 2021
WrapPixel
 
Cross Site Collection Navigation
Cross Site Collection NavigationCross Site Collection Navigation
Cross Site Collection Navigation
Thomas Daly
 
Sitecore development approach evolution – destination helix
Sitecore development approach evolution – destination helixSitecore development approach evolution – destination helix
Sitecore development approach evolution – destination helix
Peter Nazarov
 
Discovery Life Project Portfolio
Discovery Life Project PortfolioDiscovery Life Project Portfolio
Discovery Life Project PortfolioJaco Koekemoer
 
Abinitio Experienced resume-Anilkumar
Abinitio Experienced resume-AnilkumarAbinitio Experienced resume-Anilkumar
Abinitio Experienced resume-Anilkumaranilkumar kagitha
 
Envision IT - Application Lifecycle Management for SharePoint in the Enterprise
Envision IT - Application Lifecycle Management for SharePoint in the EnterpriseEnvision IT - Application Lifecycle Management for SharePoint in the Enterprise
Envision IT - Application Lifecycle Management for SharePoint in the Enterprise
Envision IT
 
Ember.js: Jump Start
Ember.js: Jump Start Ember.js: Jump Start
Ember.js: Jump Start
Viacheslav Bukach
 
Eclipse plug in development
Eclipse plug in developmentEclipse plug in development
Eclipse plug in development
Martin Toshev
 
Build tool
Build toolBuild tool
Build tool
Mallikarjuna G D
 
Asp.NETZERO - A Workshop Presentation by Citytech Software
Asp.NETZERO - A Workshop Presentation by Citytech SoftwareAsp.NETZERO - A Workshop Presentation by Citytech Software
Asp.NETZERO - A Workshop Presentation by Citytech Software
Ritwik Das
 

Similar to Building extensible application using MEF (20)

Introduction to the Managed Extensibility Framework in Silverlight
Introduction to the Managed Extensibility Framework in SilverlightIntroduction to the Managed Extensibility Framework in Silverlight
Introduction to the Managed Extensibility Framework in Silverlight
 
.net Based Component Technologies
.net Based Component Technologies.net Based Component Technologies
.net Based Component Technologies
 
Adobe Flex - Developing Rich Internet Application Workshop Day 2
Adobe Flex - Developing Rich Internet Application Workshop Day 2Adobe Flex - Developing Rich Internet Application Workshop Day 2
Adobe Flex - Developing Rich Internet Application Workshop Day 2
 
Continuous Integration
Continuous IntegrationContinuous Integration
Continuous Integration
 
Modular PHP Development using CodeIgniter Bonfire
Modular PHP Development using CodeIgniter BonfireModular PHP Development using CodeIgniter Bonfire
Modular PHP Development using CodeIgniter Bonfire
 
Siebel Open UI Presentation
Siebel Open UI PresentationSiebel Open UI Presentation
Siebel Open UI Presentation
 
Top 5 react developer tools in 2021
 Top 5 react developer tools in 2021 Top 5 react developer tools in 2021
Top 5 react developer tools in 2021
 
Cross Site Collection Navigation using SPFx, Powershell PnP & PnP-JS
Cross Site Collection Navigation using SPFx, Powershell PnP & PnP-JSCross Site Collection Navigation using SPFx, Powershell PnP & PnP-JS
Cross Site Collection Navigation using SPFx, Powershell PnP & PnP-JS
 
Using BladeRunnerJS to Build Front-End Apps that Scale - Fluent 2014
Using BladeRunnerJS to Build Front-End Apps that Scale - Fluent 2014Using BladeRunnerJS to Build Front-End Apps that Scale - Fluent 2014
Using BladeRunnerJS to Build Front-End Apps that Scale - Fluent 2014
 
Managing OSS license obligations
Managing OSS license obligationsManaging OSS license obligations
Managing OSS license obligations
 
Top 7 react developer tools to use in 2021
Top 7 react developer tools to use in 2021Top 7 react developer tools to use in 2021
Top 7 react developer tools to use in 2021
 
Cross Site Collection Navigation
Cross Site Collection NavigationCross Site Collection Navigation
Cross Site Collection Navigation
 
Sitecore development approach evolution – destination helix
Sitecore development approach evolution – destination helixSitecore development approach evolution – destination helix
Sitecore development approach evolution – destination helix
 
Discovery Life Project Portfolio
Discovery Life Project PortfolioDiscovery Life Project Portfolio
Discovery Life Project Portfolio
 
Abinitio Experienced resume-Anilkumar
Abinitio Experienced resume-AnilkumarAbinitio Experienced resume-Anilkumar
Abinitio Experienced resume-Anilkumar
 
Envision IT - Application Lifecycle Management for SharePoint in the Enterprise
Envision IT - Application Lifecycle Management for SharePoint in the EnterpriseEnvision IT - Application Lifecycle Management for SharePoint in the Enterprise
Envision IT - Application Lifecycle Management for SharePoint in the Enterprise
 
Ember.js: Jump Start
Ember.js: Jump Start Ember.js: Jump Start
Ember.js: Jump Start
 
Eclipse plug in development
Eclipse plug in developmentEclipse plug in development
Eclipse plug in development
 
Build tool
Build toolBuild tool
Build tool
 
Asp.NETZERO - A Workshop Presentation by Citytech Software
Asp.NETZERO - A Workshop Presentation by Citytech SoftwareAsp.NETZERO - A Workshop Presentation by Citytech Software
Asp.NETZERO - A Workshop Presentation by Citytech Software
 

Recently uploaded

Atelier - Innover avec l’IA Générative et les graphes de connaissances
Atelier - Innover avec l’IA Générative et les graphes de connaissancesAtelier - Innover avec l’IA Générative et les graphes de connaissances
Atelier - Innover avec l’IA Générative et les graphes de connaissances
Neo4j
 
Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024
Paco van Beckhoven
 
How to Position Your Globus Data Portal for Success Ten Good Practices
How to Position Your Globus Data Portal for Success Ten Good PracticesHow to Position Your Globus Data Portal for Success Ten Good Practices
How to Position Your Globus Data Portal for Success Ten Good Practices
Globus
 
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoamOpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
takuyayamamoto1800
 
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Globus
 
Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024
Globus
 
Vitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke Java Microservices Resume.pdfVitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
Safe Software
 
Text-Summarization-of-Breaking-News-Using-Fine-tuning-BART-Model.pptx
Text-Summarization-of-Breaking-News-Using-Fine-tuning-BART-Model.pptxText-Summarization-of-Breaking-News-Using-Fine-tuning-BART-Model.pptx
Text-Summarization-of-Breaking-News-Using-Fine-tuning-BART-Model.pptx
ShamsuddeenMuhammadA
 
openEuler Case Study - The Journey to Supply Chain Security
openEuler Case Study - The Journey to Supply Chain SecurityopenEuler Case Study - The Journey to Supply Chain Security
openEuler Case Study - The Journey to Supply Chain Security
Shane Coughlan
 
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Shahin Sheidaei
 
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdfDominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
AMB-Review
 
Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024
Globus
 
How Recreation Management Software Can Streamline Your Operations.pptx
How Recreation Management Software Can Streamline Your Operations.pptxHow Recreation Management Software Can Streamline Your Operations.pptx
How Recreation Management Software Can Streamline Your Operations.pptx
wottaspaceseo
 
Prosigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology SolutionsProsigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology Solutions
Prosigns
 
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Globus
 
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdf
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdfAutomated software refactoring with OpenRewrite and Generative AI.pptx.pdf
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdf
timtebeek1
 
Pro Unity Game Development with C-sharp Book
Pro Unity Game Development with C-sharp BookPro Unity Game Development with C-sharp Book
Pro Unity Game Development with C-sharp Book
abdulrafaychaudhry
 
AI Pilot Review: The World’s First Virtual Assistant Marketing Suite
AI Pilot Review: The World’s First Virtual Assistant Marketing SuiteAI Pilot Review: The World’s First Virtual Assistant Marketing Suite
AI Pilot Review: The World’s First Virtual Assistant Marketing Suite
Google
 
GOING AOT WITH GRAALVM FOR SPRING BOOT (SPRING IO)
GOING AOT WITH GRAALVM FOR  SPRING BOOT (SPRING IO)GOING AOT WITH GRAALVM FOR  SPRING BOOT (SPRING IO)
GOING AOT WITH GRAALVM FOR SPRING BOOT (SPRING IO)
Alina Yurenko
 

Recently uploaded (20)

Atelier - Innover avec l’IA Générative et les graphes de connaissances
Atelier - Innover avec l’IA Générative et les graphes de connaissancesAtelier - Innover avec l’IA Générative et les graphes de connaissances
Atelier - Innover avec l’IA Générative et les graphes de connaissances
 
Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024
 
How to Position Your Globus Data Portal for Success Ten Good Practices
How to Position Your Globus Data Portal for Success Ten Good PracticesHow to Position Your Globus Data Portal for Success Ten Good Practices
How to Position Your Globus Data Portal for Success Ten Good Practices
 
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoamOpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
 
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
 
Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024
 
Vitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke Java Microservices Resume.pdfVitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke Java Microservices Resume.pdf
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
 
Text-Summarization-of-Breaking-News-Using-Fine-tuning-BART-Model.pptx
Text-Summarization-of-Breaking-News-Using-Fine-tuning-BART-Model.pptxText-Summarization-of-Breaking-News-Using-Fine-tuning-BART-Model.pptx
Text-Summarization-of-Breaking-News-Using-Fine-tuning-BART-Model.pptx
 
openEuler Case Study - The Journey to Supply Chain Security
openEuler Case Study - The Journey to Supply Chain SecurityopenEuler Case Study - The Journey to Supply Chain Security
openEuler Case Study - The Journey to Supply Chain Security
 
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
 
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdfDominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
 
Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024
 
How Recreation Management Software Can Streamline Your Operations.pptx
How Recreation Management Software Can Streamline Your Operations.pptxHow Recreation Management Software Can Streamline Your Operations.pptx
How Recreation Management Software Can Streamline Your Operations.pptx
 
Prosigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology SolutionsProsigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology Solutions
 
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
 
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdf
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdfAutomated software refactoring with OpenRewrite and Generative AI.pptx.pdf
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdf
 
Pro Unity Game Development with C-sharp Book
Pro Unity Game Development with C-sharp BookPro Unity Game Development with C-sharp Book
Pro Unity Game Development with C-sharp Book
 
AI Pilot Review: The World’s First Virtual Assistant Marketing Suite
AI Pilot Review: The World’s First Virtual Assistant Marketing SuiteAI Pilot Review: The World’s First Virtual Assistant Marketing Suite
AI Pilot Review: The World’s First Virtual Assistant Marketing Suite
 
GOING AOT WITH GRAALVM FOR SPRING BOOT (SPRING IO)
GOING AOT WITH GRAALVM FOR  SPRING BOOT (SPRING IO)GOING AOT WITH GRAALVM FOR  SPRING BOOT (SPRING IO)
GOING AOT WITH GRAALVM FOR SPRING BOOT (SPRING IO)
 

Building extensible application using MEF

  • 2. Overview • MEF is library for creating extensible applications. It allows applications to discover and use components without no configuration required. • MEF can also be used as IOC / DI container but its primarily designed with the goal of developing extensible application. • There are other IOC containers like Unity, Ninject, Autofac, Castle Windsor, StructureMap. • IOC / Other frameworks can be used to achieve extensibility but • They require too much development and configuration effort. Think of developing extensible application that can adapt to runtime changes using Castle or Unity. MEF support this out of the Box with no configuration. • Some of those frameworks are too heavyweight for simple programming model and not full featured.
  • 3. Scenario • You are developing a large application that needs support for extensibility. Other developers should be able to extend your application by developing components. • You want develop your application with loosely coupled plug-in based architecture like Visual Studio, Microsoft Office, Firefox browser. • Visual Studio is real world example using MEF to support extensibility. • Key points • Your application and components should be decoupled and independent. • You application does not know about component at compile time. Application should be able to integrate / plugin those components at runtime without need of rebuilding the application. • Components does not have access to source code of your application but still can extend / add features to your application. Application does not have access to component source code.
  • 4. Without MEF and problems • You develop main application. • You develop components, include them as a source code in your main application solution, add them as a reference in your main application and modify application to use them. • Problems? Problems and Problems (Is your application extensible anymore?) • Every time a component is developed / updated, main application source code needs to be changed to add reference to that component and modify code to use that. Statically composed. • Component developer does not have access to your code and your main application does not have access to component? • Does Visual Studio and ReSharper extension know each other and have their source code. No. But they still work together.
  • 5. MEF as a Solution • Decoupling between application and components • Statically compiled VS dynamically composed • Known (at compile time) VS Unknown (Discovered at run time) • Convert your app into Platform
  • 6. How MEF works Main Application Import ILogger Catalog Assemblies Parts Composition Container MEF Part A MyLogger Component Export ILogger Contract ILogger Key points • Import • Export • Discover and Compose
  • 7. Concepts • Part: Part known as Export can provide services to other parts and parts known as Import can consume services by other parts. • Contract: Parts talk to each other using contract hence parts gets decoupled. Import part specifies contract that it needs and Export part specifies contract that it provides. • Import, ImportMany: Attribute applied on Part that creates need. • Export: Attribute applied on Part that fulfills the need. • Catalog: Knows where to find exported parts. Discover assemblies at run-time from plugins folder, discover and load parts. Contains collection of exported parts. • Compose: Exported and Imported parts are assembles together. Match the exported parts from the assembly with the parts that want to import / use them
  • 8. Programming Model • Attribute based programming model • Apply attributes to your classes, methods, properties, fields and constructor to determine how pieces are composed within MEF • Import -> Field, Property, Constructor • Export -> Class, Method, Property, Field • Convection based programming model • Define set of rules that determines what is composed and what is not
  • 11. Import • Import • ImportMany • Import(AllowRecompsition = true) • ImportingConstructor • Lazy<T> • IPartImportsSatisifiedNotification
  • 13. Catalog • Type Catalog • Assembly Catalog • Directory Catalog • Aggregate Catalog
  • 14. MEF Re-composition DirectoryCatalog CompositionContainer FileSystemWatcher Watch for added / modified files DirectoryCatalog.Refresh to include added / modifies assemblies Issues DirectoryCatalog.Refresh only works on added / removed assemblies and not updated assemblies. When assembly is removed from folder, Refresh will only remove ComposablePartDefination objects from catalog but does not unloaded assembly from process. Existing assemblies cannot be updated when main application has loaded those assemblies. Use Shadow Copy to solve this problem.
  • 15. Facts about MEF • MEF is open source hosted on CodePlex • MEF is lightweight (One DLL -> System.Composition.ComponentModel) • MEF is already shipped with .Net framework • MEF can be used with any .Net platform. WPF, Silverlight, ASP.NET MVC, WinForms • MEF has 2 versions • MEF that is already shipped with .Net Framework (System.Composition.ComponentModel) • Lightweight version of MEF optimized for static composition scenarios and provides faster composition