SlideShare a Scribd company logo
1 of 23
Download to read offline
Managed Extensibility Framework (MEF)




1nn0vaLab
Managed Extensibility Framework (MEF)




1nn0vaLab
Managed Extensibility Framework (MEF)




            MEF è un framework che offre
            alle applicazioni la capacità di
              essere estese dinamicamente
            attraverso componenti esterni
                        noti solo a runtime




1nn0vaLab
for extension

              part / component



            for modification


1nn0vaLab
Managed Extensibility Framework (MEF)




              Export it
             Import it
            Compose it



1nn0vaLab
Managed Extensibility Framework (MEF)

                           Definiamo prima il
                           servizio (part) da esporre




               Utilizzare sempre le
               interfacce per definire i
               contratti da esportare
      Part A


1nn0vaLab
Managed Extensibility Framework (MEF)

                                  Definiamo prima il
                                  servizio (part) da esporre




 Dichiariamo
 l’implementazione da
 rendere disponibile ai
 consumer




      Part A


1nn0vaLab
Managed Extensibility Framework (MEF)




     Definiamo nel
     consumer il “punto
     di estensione”




      Part A


1nn0vaLab
Managed Extensibility Framework (MEF)




            Dove cerca MEF le
            parti da utilizzare?        TypeCatalog
                                        AssemblyCatalog
                Catalog
                                        DirectoryCatalog

                                        AggregateCatalog



1nn0vaLab
Managed Extensibility Framework (MEF)




                                      Come risolve i collegamenti
                                      import/export?
            Dove cerca MEF le
            parti da utilizzare?

                                          Container




1nn0vaLab
It’s DEMO
    time!
Managed Extensibility Framework (MEF)


 MEF architecture




1nn0vaLab
Managed Extensibility Framework (MEF)




     Part by discovery    Part by registration

                          External configuration,
     NO configuration
                          via Fluent API or XML

     Wiring in the part   Auto Wiring

     Almost pure POCO     Pure POCO


1nn0vaLab
Managed Extensibility Framework (MEF)




            • Metadata support
            • Be “lazy”
            • Recomposition


1nn0vaLab
Managed Extensibility Framework (MEF)




                    Possiamo associare al servizio
            informazioni aggiuntive (metadati) in
             modo da farle leggere ai consumer ...



    ... per esempio per filtrare
    le implementazioni da
    importare

1nn0vaLab
Managed Extensibility Framework (MEF)




    ... per esempio per filtrare
    le implementazioni da
    importare

1nn0vaLab
Managed Extensibility Framework (MEF)




            Eseguire l’importazione solo nel
            momento in cui viene utilizzata!



    Lazy<T,M> (con M metadata) è utile
    per filtrare le importazioni in base ai
    metadati


1nn0vaLab
Managed Extensibility Framework (MEF)




                  Con MEF possiamo avere la
     ricomposizione automatica delle parti in
         caso di aggiunta di nuove estensioni
               (o rimozione di una esistente)

            [ImportMany(AllowRecomposition(true)]

                            +
               IPartImportsSatisfiedNotification

1nn0vaLab
Managed Extensibility Framework (MEF)




            Dynamically loading XAPs with MEF
            http://channel9.msdn.com/Shows/SilverlightTV/Silverlight
            -TV-11-Dynamically-Loading-XAPs-with-MEF



1nn0vaLab
Managed Extensibility Framework (MEF)


 Resources
             Project hosting on codeplex
             http://mef.codeplex.com

             Community-developed library of
             extensions
             http://mefcontrib.codeplex.com/

             Hamilton Verissimo       (the “MEF man”)
             http://blogs.msdn.com/b/hammett/

             Glenn Block   (the “MEF maniac”)
             http://codebetter.com/glennblock/


1nn0vaLab
Credits
Le immagini contenute in questa presentazione
eccetto la foto iniziale acquistata su
iStockPhoto hanno licenza Creative Commons

Slide 2 : http://www.flickr.com/photos/69691418@N00/4368951793/
Slide 3 : http://www.flickr.com/photos/16013376@N00/4562002778/
Thank You!   MANUEL SCAPOLAN
             website: www.manuelscapolan.it
             twitter: manuelscapolan
             e-mail: info@manuelscapolan.it




                                              23

More Related Content

What's hot

Dot netcampus2015 green-template
Dot netcampus2015 green-templateDot netcampus2015 green-template
Dot netcampus2015 green-templateDotNetCampus
 
Actions on Google e Alexa skills per .NET lovers
Actions on Google e Alexa skills per .NET loversActions on Google e Alexa skills per .NET lovers
Actions on Google e Alexa skills per .NET loversLorenzo Giudici
 
ASP.NET MVC: sfruttare la piattaforma al 100%
ASP.NET MVC: sfruttare la piattaforma al 100%ASP.NET MVC: sfruttare la piattaforma al 100%
ASP.NET MVC: sfruttare la piattaforma al 100%DomusDotNet
 
DotNetCampus - Continuous Integration con Sql Server
DotNetCampus - Continuous Integration con Sql ServerDotNetCampus - Continuous Integration con Sql Server
DotNetCampus - Continuous Integration con Sql ServerAlessandro Alpi
 
Introduzione a jQuery
Introduzione a jQueryIntroduzione a jQuery
Introduzione a jQuerySandro Marcon
 
Del furia signalr-to-the-max
Del furia   signalr-to-the-maxDel furia   signalr-to-the-max
Del furia signalr-to-the-maxDotNetCampus
 
APPSTUDIO: DA ZERO ALLO STORE IN 50 MINUTI!
APPSTUDIO: DA ZERO ALLO STORE IN 50 MINUTI!APPSTUDIO: DA ZERO ALLO STORE IN 50 MINUTI!
APPSTUDIO: DA ZERO ALLO STORE IN 50 MINUTI!DotNetCampus
 
70-485: ADVANCED OF DEVELOPING WINDOWS STORE APPS USING C#
70-485: ADVANCED OF DEVELOPING WINDOWS STORE APPS USING C#70-485: ADVANCED OF DEVELOPING WINDOWS STORE APPS USING C#
70-485: ADVANCED OF DEVELOPING WINDOWS STORE APPS USING C#DotNetCampus
 
Intelligenza artificiale nel mondo front-end - CodeGen2021
Intelligenza artificiale nel mondo front-end - CodeGen2021Intelligenza artificiale nel mondo front-end - CodeGen2021
Intelligenza artificiale nel mondo front-end - CodeGen2021Michele Aponte
 
Slide typescript - net campus
Slide typescript - net campusSlide typescript - net campus
Slide typescript - net campusDotNetCampus
 
Javascript task automation
Javascript task automationJavascript task automation
Javascript task automationDotNetCampus
 
Introduzione a Service Fabric e Actor Model
Introduzione a Service Fabric e Actor ModelIntroduzione a Service Fabric e Actor Model
Introduzione a Service Fabric e Actor ModelAndrea Tosato
 
Async: scalabilità e responsiveness senza pari! @ CDays
Async: scalabilità e responsiveness senza pari! @ CDaysAsync: scalabilità e responsiveness senza pari! @ CDays
Async: scalabilità e responsiveness senza pari! @ CDaysMatteo Baglini
 
Javascript task automation
Javascript task automationJavascript task automation
Javascript task automationAntonio Liccardi
 
[Alam aeki] Guida illustrata alla modellazione di un dominio con Event Sourci...
[Alam aeki] Guida illustrata alla modellazione di un dominio con Event Sourci...[Alam aeki] Guida illustrata alla modellazione di un dominio con Event Sourci...
[Alam aeki] Guida illustrata alla modellazione di un dominio con Event Sourci...Andrea Balducci
 
Alla scoperta di gRPC
Alla scoperta di gRPCAlla scoperta di gRPC
Alla scoperta di gRPCAndrea Dottor
 
Windows azure - abbattere tempi e costi di sviluppo
Windows azure - abbattere tempi e costi di sviluppoWindows azure - abbattere tempi e costi di sviluppo
Windows azure - abbattere tempi e costi di sviluppoAndrea Dottor
 

What's hot (20)

Dot netcampus2015 green-template
Dot netcampus2015 green-templateDot netcampus2015 green-template
Dot netcampus2015 green-template
 
Actions on Google e Alexa skills per .NET lovers
Actions on Google e Alexa skills per .NET loversActions on Google e Alexa skills per .NET lovers
Actions on Google e Alexa skills per .NET lovers
 
ASP.NET MVC: sfruttare la piattaforma al 100%
ASP.NET MVC: sfruttare la piattaforma al 100%ASP.NET MVC: sfruttare la piattaforma al 100%
ASP.NET MVC: sfruttare la piattaforma al 100%
 
DotNetCampus - Continuous Integration con Sql Server
DotNetCampus - Continuous Integration con Sql ServerDotNetCampus - Continuous Integration con Sql Server
DotNetCampus - Continuous Integration con Sql Server
 
Introduzione a jQuery
Introduzione a jQueryIntroduzione a jQuery
Introduzione a jQuery
 
jQuery
jQueryjQuery
jQuery
 
Del furia signalr-to-the-max
Del furia   signalr-to-the-maxDel furia   signalr-to-the-max
Del furia signalr-to-the-max
 
APPSTUDIO: DA ZERO ALLO STORE IN 50 MINUTI!
APPSTUDIO: DA ZERO ALLO STORE IN 50 MINUTI!APPSTUDIO: DA ZERO ALLO STORE IN 50 MINUTI!
APPSTUDIO: DA ZERO ALLO STORE IN 50 MINUTI!
 
70-485: ADVANCED OF DEVELOPING WINDOWS STORE APPS USING C#
70-485: ADVANCED OF DEVELOPING WINDOWS STORE APPS USING C#70-485: ADVANCED OF DEVELOPING WINDOWS STORE APPS USING C#
70-485: ADVANCED OF DEVELOPING WINDOWS STORE APPS USING C#
 
Akka.net & Actor Model
Akka.net & Actor ModelAkka.net & Actor Model
Akka.net & Actor Model
 
Intelligenza artificiale nel mondo front-end - CodeGen2021
Intelligenza artificiale nel mondo front-end - CodeGen2021Intelligenza artificiale nel mondo front-end - CodeGen2021
Intelligenza artificiale nel mondo front-end - CodeGen2021
 
Slide typescript - net campus
Slide typescript - net campusSlide typescript - net campus
Slide typescript - net campus
 
Wcf data services
Wcf data servicesWcf data services
Wcf data services
 
Javascript task automation
Javascript task automationJavascript task automation
Javascript task automation
 
Introduzione a Service Fabric e Actor Model
Introduzione a Service Fabric e Actor ModelIntroduzione a Service Fabric e Actor Model
Introduzione a Service Fabric e Actor Model
 
Async: scalabilità e responsiveness senza pari! @ CDays
Async: scalabilità e responsiveness senza pari! @ CDaysAsync: scalabilità e responsiveness senza pari! @ CDays
Async: scalabilità e responsiveness senza pari! @ CDays
 
Javascript task automation
Javascript task automationJavascript task automation
Javascript task automation
 
[Alam aeki] Guida illustrata alla modellazione di un dominio con Event Sourci...
[Alam aeki] Guida illustrata alla modellazione di un dominio con Event Sourci...[Alam aeki] Guida illustrata alla modellazione di un dominio con Event Sourci...
[Alam aeki] Guida illustrata alla modellazione di un dominio con Event Sourci...
 
Alla scoperta di gRPC
Alla scoperta di gRPCAlla scoperta di gRPC
Alla scoperta di gRPC
 
Windows azure - abbattere tempi e costi di sviluppo
Windows azure - abbattere tempi e costi di sviluppoWindows azure - abbattere tempi e costi di sviluppo
Windows azure - abbattere tempi e costi di sviluppo
 

Viewers also liked

Viewers also liked (18)

Tutte le novità di ASP.NET MVC3
Tutte le novità di ASP.NET MVC3Tutte le novità di ASP.NET MVC3
Tutte le novità di ASP.NET MVC3
 
Domain Driven Design e CQRS
Domain Driven Design e CQRSDomain Driven Design e CQRS
Domain Driven Design e CQRS
 
Dai delegati a LINQ con C#
Dai delegati a LINQ con C#Dai delegati a LINQ con C#
Dai delegati a LINQ con C#
 
NOSQL
NOSQLNOSQL
NOSQL
 
Scrum? E' come fare il bucato!
Scrum? E' come fare il bucato!Scrum? E' come fare il bucato!
Scrum? E' come fare il bucato!
 
C# e la Framework Class Library
C# e la Framework Class LibraryC# e la Framework Class Library
C# e la Framework Class Library
 
JavaScript Object Oriented
JavaScript Object OrientedJavaScript Object Oriented
JavaScript Object Oriented
 
TFS and Scrum - Lessons Learned
TFS and Scrum - Lessons LearnedTFS and Scrum - Lessons Learned
TFS and Scrum - Lessons Learned
 
JavaScript
JavaScriptJavaScript
JavaScript
 
Knockout.js
Knockout.jsKnockout.js
Knockout.js
 
Entity Framework 4.0 vs NHibernate
Entity Framework 4.0 vs NHibernateEntity Framework 4.0 vs NHibernate
Entity Framework 4.0 vs NHibernate
 
Stai guardando i dati sbagliati
Stai guardando i dati sbagliatiStai guardando i dati sbagliati
Stai guardando i dati sbagliati
 
Costruire l'identità digitale con il piano editoriale
Costruire l'identità digitale con il piano editorialeCostruire l'identità digitale con il piano editoriale
Costruire l'identità digitale con il piano editoriale
 
Liberate il kraken
Liberate il krakenLiberate il kraken
Liberate il kraken
 
OOP with C#
OOP with C#OOP with C#
OOP with C#
 
HTML e CSS
HTML e CSSHTML e CSS
HTML e CSS
 
Object-oriented Programming-with C#
Object-oriented Programming-with C#Object-oriented Programming-with C#
Object-oriented Programming-with C#
 
Transactions redefined
Transactions redefinedTransactions redefined
Transactions redefined
 

Similar to Managed Extensibility Framework (MEF)

Corso Avanzato Alfresco Ecm
Corso Avanzato Alfresco EcmCorso Avanzato Alfresco Ecm
Corso Avanzato Alfresco Ecmedoardo fraioli
 
Liferay 7: Come realizzare un client SOAP con Apache CXF in OSGi Style
Liferay 7: Come realizzare un client SOAP con Apache CXF in OSGi StyleLiferay 7: Come realizzare un client SOAP con Apache CXF in OSGi Style
Liferay 7: Come realizzare un client SOAP con Apache CXF in OSGi StyleAntonio Musarra
 
Joomla! 2.5 - Presentazione al PUG Friuli
Joomla! 2.5 - Presentazione al PUG FriuliJoomla! 2.5 - Presentazione al PUG Friuli
Joomla! 2.5 - Presentazione al PUG Friuliccaps
 
Presentazione finale dottorato 15 aprile 2011
Presentazione finale dottorato 15 aprile 2011Presentazione finale dottorato 15 aprile 2011
Presentazione finale dottorato 15 aprile 2011steccami
 
Usare le nuove WCF Web Api per creare servizi RESTful
Usare le nuove WCF Web Api per creare servizi RESTfulUsare le nuove WCF Web Api per creare servizi RESTful
Usare le nuove WCF Web Api per creare servizi RESTfulLuca Milan
 
SPRING - MAVEN - REST API (ITA - Luglio 2017)
SPRING - MAVEN - REST API (ITA - Luglio 2017)SPRING - MAVEN - REST API (ITA - Luglio 2017)
SPRING - MAVEN - REST API (ITA - Luglio 2017)Valerio Radice
 
Sviluppo di applicazioni in E(fx)clipse capitolo 02-rev01-20072018
Sviluppo di applicazioni in E(fx)clipse capitolo 02-rev01-20072018Sviluppo di applicazioni in E(fx)clipse capitolo 02-rev01-20072018
Sviluppo di applicazioni in E(fx)clipse capitolo 02-rev01-20072018Nelson Firmani
 
Installazione del cms alfresco
Installazione del cms alfrescoInstallazione del cms alfresco
Installazione del cms alfrescoMirco Leo
 
Progea - PowerHMI brochures Ita
Progea - PowerHMI brochures ItaProgea - PowerHMI brochures Ita
Progea - PowerHMI brochures ItaPROGEA s.r.l.
 
Gaetano Giunta: introduzione agli eZ components
Gaetano Giunta: introduzione agli eZ componentsGaetano Giunta: introduzione agli eZ components
Gaetano Giunta: introduzione agli eZ componentsFrancesco Fullone
 
Sistemi Context-aware: Esercitazione 3
Sistemi Context-aware: Esercitazione 3Sistemi Context-aware: Esercitazione 3
Sistemi Context-aware: Esercitazione 3Marco Loregian
 
Windows Workflow Foundation 4
Windows Workflow Foundation 4Windows Workflow Foundation 4
Windows Workflow Foundation 4Felice Pescatore
 
Enterprise Spring and Flex applications
Enterprise Spring and Flex applicationsEnterprise Spring and Flex applications
Enterprise Spring and Flex applicationsmarcocasario
 
Universal Store Apps - Mobile day by DotNetCampania
Universal Store Apps - Mobile day by DotNetCampaniaUniversal Store Apps - Mobile day by DotNetCampania
Universal Store Apps - Mobile day by DotNetCampaniaEmanuele Garofalo
 

Similar to Managed Extensibility Framework (MEF) (20)

I plugin mef
I plugin mefI plugin mef
I plugin mef
 
Introduzione WPF
Introduzione WPFIntroduzione WPF
Introduzione WPF
 
DDive11 - xpages
DDive11 - xpagesDDive11 - xpages
DDive11 - xpages
 
Corso Avanzato Alfresco Ecm
Corso Avanzato Alfresco EcmCorso Avanzato Alfresco Ecm
Corso Avanzato Alfresco Ecm
 
Liferay 7: Come realizzare un client SOAP con Apache CXF in OSGi Style
Liferay 7: Come realizzare un client SOAP con Apache CXF in OSGi StyleLiferay 7: Come realizzare un client SOAP con Apache CXF in OSGi Style
Liferay 7: Come realizzare un client SOAP con Apache CXF in OSGi Style
 
Joomla! 2.5 - Presentazione al PUG Friuli
Joomla! 2.5 - Presentazione al PUG FriuliJoomla! 2.5 - Presentazione al PUG Friuli
Joomla! 2.5 - Presentazione al PUG Friuli
 
Hardware e plugin
Hardware e pluginHardware e plugin
Hardware e plugin
 
Ug apm - introscope-isp-user group
Ug  apm - introscope-isp-user groupUg  apm - introscope-isp-user group
Ug apm - introscope-isp-user group
 
Presentazione finale dottorato 15 aprile 2011
Presentazione finale dottorato 15 aprile 2011Presentazione finale dottorato 15 aprile 2011
Presentazione finale dottorato 15 aprile 2011
 
Usare le nuove WCF Web Api per creare servizi RESTful
Usare le nuove WCF Web Api per creare servizi RESTfulUsare le nuove WCF Web Api per creare servizi RESTful
Usare le nuove WCF Web Api per creare servizi RESTful
 
SPRING - MAVEN - REST API (ITA - Luglio 2017)
SPRING - MAVEN - REST API (ITA - Luglio 2017)SPRING - MAVEN - REST API (ITA - Luglio 2017)
SPRING - MAVEN - REST API (ITA - Luglio 2017)
 
Sviluppo di applicazioni in E(fx)clipse capitolo 02-rev01-20072018
Sviluppo di applicazioni in E(fx)clipse capitolo 02-rev01-20072018Sviluppo di applicazioni in E(fx)clipse capitolo 02-rev01-20072018
Sviluppo di applicazioni in E(fx)clipse capitolo 02-rev01-20072018
 
Dot net framework 2
Dot net framework 2Dot net framework 2
Dot net framework 2
 
Installazione del cms alfresco
Installazione del cms alfrescoInstallazione del cms alfresco
Installazione del cms alfresco
 
Progea - PowerHMI brochures Ita
Progea - PowerHMI brochures ItaProgea - PowerHMI brochures Ita
Progea - PowerHMI brochures Ita
 
Gaetano Giunta: introduzione agli eZ components
Gaetano Giunta: introduzione agli eZ componentsGaetano Giunta: introduzione agli eZ components
Gaetano Giunta: introduzione agli eZ components
 
Sistemi Context-aware: Esercitazione 3
Sistemi Context-aware: Esercitazione 3Sistemi Context-aware: Esercitazione 3
Sistemi Context-aware: Esercitazione 3
 
Windows Workflow Foundation 4
Windows Workflow Foundation 4Windows Workflow Foundation 4
Windows Workflow Foundation 4
 
Enterprise Spring and Flex applications
Enterprise Spring and Flex applicationsEnterprise Spring and Flex applications
Enterprise Spring and Flex applications
 
Universal Store Apps - Mobile day by DotNetCampania
Universal Store Apps - Mobile day by DotNetCampaniaUniversal Store Apps - Mobile day by DotNetCampania
Universal Store Apps - Mobile day by DotNetCampania
 

Managed Extensibility Framework (MEF)

  • 1.
  • 4. Managed Extensibility Framework (MEF) MEF è un framework che offre alle applicazioni la capacità di essere estese dinamicamente attraverso componenti esterni noti solo a runtime 1nn0vaLab
  • 5. for extension part / component for modification 1nn0vaLab
  • 6. Managed Extensibility Framework (MEF) Export it Import it Compose it 1nn0vaLab
  • 7. Managed Extensibility Framework (MEF) Definiamo prima il servizio (part) da esporre Utilizzare sempre le interfacce per definire i contratti da esportare Part A 1nn0vaLab
  • 8. Managed Extensibility Framework (MEF) Definiamo prima il servizio (part) da esporre Dichiariamo l’implementazione da rendere disponibile ai consumer Part A 1nn0vaLab
  • 9. Managed Extensibility Framework (MEF) Definiamo nel consumer il “punto di estensione” Part A 1nn0vaLab
  • 10. Managed Extensibility Framework (MEF) Dove cerca MEF le parti da utilizzare? TypeCatalog AssemblyCatalog Catalog DirectoryCatalog AggregateCatalog 1nn0vaLab
  • 11. Managed Extensibility Framework (MEF) Come risolve i collegamenti import/export? Dove cerca MEF le parti da utilizzare? Container 1nn0vaLab
  • 12. It’s DEMO time!
  • 13. Managed Extensibility Framework (MEF) MEF architecture 1nn0vaLab
  • 14. Managed Extensibility Framework (MEF) Part by discovery Part by registration External configuration, NO configuration via Fluent API or XML Wiring in the part Auto Wiring Almost pure POCO Pure POCO 1nn0vaLab
  • 15. Managed Extensibility Framework (MEF) • Metadata support • Be “lazy” • Recomposition 1nn0vaLab
  • 16. Managed Extensibility Framework (MEF) Possiamo associare al servizio informazioni aggiuntive (metadati) in modo da farle leggere ai consumer ... ... per esempio per filtrare le implementazioni da importare 1nn0vaLab
  • 17. Managed Extensibility Framework (MEF) ... per esempio per filtrare le implementazioni da importare 1nn0vaLab
  • 18. Managed Extensibility Framework (MEF) Eseguire l’importazione solo nel momento in cui viene utilizzata! Lazy<T,M> (con M metadata) è utile per filtrare le importazioni in base ai metadati 1nn0vaLab
  • 19. Managed Extensibility Framework (MEF) Con MEF possiamo avere la ricomposizione automatica delle parti in caso di aggiunta di nuove estensioni (o rimozione di una esistente) [ImportMany(AllowRecomposition(true)] + IPartImportsSatisfiedNotification 1nn0vaLab
  • 20. Managed Extensibility Framework (MEF) Dynamically loading XAPs with MEF http://channel9.msdn.com/Shows/SilverlightTV/Silverlight -TV-11-Dynamically-Loading-XAPs-with-MEF 1nn0vaLab
  • 21. Managed Extensibility Framework (MEF) Resources Project hosting on codeplex http://mef.codeplex.com Community-developed library of extensions http://mefcontrib.codeplex.com/ Hamilton Verissimo (the “MEF man”) http://blogs.msdn.com/b/hammett/ Glenn Block (the “MEF maniac”) http://codebetter.com/glennblock/ 1nn0vaLab
  • 22. Credits Le immagini contenute in questa presentazione eccetto la foto iniziale acquistata su iStockPhoto hanno licenza Creative Commons Slide 2 : http://www.flickr.com/photos/69691418@N00/4368951793/ Slide 3 : http://www.flickr.com/photos/16013376@N00/4562002778/
  • 23. Thank You! MANUEL SCAPOLAN website: www.manuelscapolan.it twitter: manuelscapolan e-mail: info@manuelscapolan.it 23