Managed Extensibility Framework 2010 01
-
Upload
david-giard -
Category
Technology
-
view
2.395 -
download
2
Transcript of Managed Extensibility Framework 2010 01
![Page 2: Managed Extensibility Framework 2010 01](https://reader036.fdocuments.in/reader036/viewer/2022062404/55496b31b4c905dd558b4de0/html5/thumbnails/2.jpg)
MANAGED EXTENSIBILITY FRAMEWORK
Beta 2
![Page 3: Managed Extensibility Framework 2010 01](https://reader036.fdocuments.in/reader036/viewer/2022062404/55496b31b4c905dd558b4de0/html5/thumbnails/3.jpg)
Compile and Deploy
TIGHT COUPLING
DLL
DLL
EXE
![Page 4: Managed Extensibility Framework 2010 01](https://reader036.fdocuments.in/reader036/viewer/2022062404/55496b31b4c905dd558b4de0/html5/thumbnails/4.jpg)
MEF
LOOSE COUPLING WITH MEF
Compile and Deploy
Contract
Contract
ContractContract
DLL
DLL
EXE
DLL
![Page 5: Managed Extensibility Framework 2010 01](https://reader036.fdocuments.in/reader036/viewer/2022062404/55496b31b4c905dd558b4de0/html5/thumbnails/5.jpg)
MANAGED EXTENSIBILITY FRAMEWORK Applications consists of loosely-coupled
components that are discovered and composed at runtime
![Page 6: Managed Extensibility Framework 2010 01](https://reader036.fdocuments.in/reader036/viewer/2022062404/55496b31b4c905dd558b4de0/html5/thumbnails/6.jpg)
ADVANTAGES OF MEF
Loose Coupling Swap Classes at Runtime No Recompile or Redeploy Single Plug-In Architecture
![Page 7: Managed Extensibility Framework 2010 01](https://reader036.fdocuments.in/reader036/viewer/2022062404/55496b31b4c905dd558b4de0/html5/thumbnails/7.jpg)
MEF USAGE SCENARIOS
Empower developers to extend your application without modifying it
Provide extra modules to your application, as needed
Use MEF as an platform ecosystem to manage all parts of your application
![Page 8: Managed Extensibility Framework 2010 01](https://reader036.fdocuments.in/reader036/viewer/2022062404/55496b31b4c905dd558b4de0/html5/thumbnails/8.jpg)
DEMO
MEFApp(Accounting)
G/L
A/R
A/P
Export
GenSetu
p
Modules for Accounting app
![Page 9: Managed Extensibility Framework 2010 01](https://reader036.fdocuments.in/reader036/viewer/2022062404/55496b31b4c905dd558b4de0/html5/thumbnails/9.jpg)
GET STARTED
MEF.CodePlex.com Download and unzip MEF_Beta_2.zip Zip file contains
DLLs Samples Source Code
![Page 10: Managed Extensibility Framework 2010 01](https://reader036.fdocuments.in/reader036/viewer/2022062404/55496b31b4c905dd558b4de0/html5/thumbnails/10.jpg)
DEVELOPER STEPS
Import
Export
Set Reference to System.ComponentModel.Composition.dll
Contract Import Export
Catalogs Composition
Contra
cts
![Page 11: Managed Extensibility Framework 2010 01](https://reader036.fdocuments.in/reader036/viewer/2022062404/55496b31b4c905dd558b4de0/html5/thumbnails/11.jpg)
MEF
CONTRACTS
[Import(“Contract1”)]String SomeThing {get; set;}
[Export(“Contract1”)]Public string SpecialThing {Get {return “A Value”};}
“A Value”
![Page 12: Managed Extensibility Framework 2010 01](https://reader036.fdocuments.in/reader036/viewer/2022062404/55496b31b4c905dd558b4de0/html5/thumbnails/12.jpg)
MEF
CONTRACTS
[Import(“Contract1”)]String SomeThing {get; set;}
[Export(“Contract1”)]Public string MoreSpecialThing {Get {return “A Different Value”};}
“A Different Value”
![Page 13: Managed Extensibility Framework 2010 01](https://reader036.fdocuments.in/reader036/viewer/2022062404/55496b31b4c905dd558b4de0/html5/thumbnails/13.jpg)
MEF
INTERFACE CONTRACTS
[Import(typeof(IFoo))]IFoo SomeFoo {get; set;}
[Export(typeof(IFoo))]public Foo: IFoo{…}
new Foo()
![Page 14: Managed Extensibility Framework 2010 01](https://reader036.fdocuments.in/reader036/viewer/2022062404/55496b31b4c905dd558b4de0/html5/thumbnails/14.jpg)
MEF
INTERFACE CONTRACTS
[ImportMany(typeof(IFoo))]List<IFoo> BunchOfFoos{get; set;}
[Export(typeof(IFoo))]public Foo1: IFoo{…} new Foo1()
[Export(typeof(IFoo))]public Foo2: IFoo{…} new Foo2()
![Page 15: Managed Extensibility Framework 2010 01](https://reader036.fdocuments.in/reader036/viewer/2022062404/55496b31b4c905dd558b4de0/html5/thumbnails/15.jpg)
COMPOSITION
Catalogs TypeCatalog AssemblyCatalog DirectoryCatalog AggregateCatalog PackageCatalog (Silverlight toolkit)
var catalog1 = new DirectoryCatalog(@"c:\MEF\Imports");var container = new CompositionContainer catalog1);container.ComposeParts(this);
![Page 16: Managed Extensibility Framework 2010 01](https://reader036.fdocuments.in/reader036/viewer/2022062404/55496b31b4c905dd558b4de0/html5/thumbnails/16.jpg)
DEMO
Using MEF
![Page 17: Managed Extensibility Framework 2010 01](https://reader036.fdocuments.in/reader036/viewer/2022062404/55496b31b4c905dd558b4de0/html5/thumbnails/17.jpg)
MEF VS DEPENDENCY INJECTION
![Page 18: Managed Extensibility Framework 2010 01](https://reader036.fdocuments.in/reader036/viewer/2022062404/55496b31b4c905dd558b4de0/html5/thumbnails/18.jpg)
RESOURCES http://MEF.codeplex.com http://www.davidgiard.com http://msmvps.com/blogs/kathleen http://blogs.msdn.com/gblock http://tinyurl.com/
TaultyMEFSilverlightVideos NPlus1.org
David Giard, MCTS, MCSD, MCSE, MCDBA
![Page 19: Managed Extensibility Framework 2010 01](https://reader036.fdocuments.in/reader036/viewer/2022062404/55496b31b4c905dd558b4de0/html5/thumbnails/19.jpg)
USER GROUPS
Great Lakes Area .Net User Group Southfield, MI migang.org
Greater Lansing .Net User Group East Lansing, MI glugnet.org
![Page 21: Managed Extensibility Framework 2010 01](https://reader036.fdocuments.in/reader036/viewer/2022062404/55496b31b4c905dd558b4de0/html5/thumbnails/21.jpg)