RIA 1.0 AA We need…. We need….. BBCC RIA 1.0 We need….. DDEEFFGGHHIIJJKK We need….
-
Upload
mathew-odiorne -
Category
Documents
-
view
231 -
download
3
Transcript of RIA 1.0 AA We need…. We need….. BBCC RIA 1.0 We need….. DDEEFFGGHHIIJJKK We need….
Building Extensible Rich Internet Applications with the Managed Extensibility FrameworkGlenn BlockProgram ManagerMicrosoft Corporation
What we’ll cover
RIA Extensions, add-ins, and plugins oh my!
Extensibility implants
Turning fat apps into slimmer apps
Reality
RIA 1.0
Reality
A
We need….
We need…..
BC
RIA 1.0
We need…..
D
EF
GH
IJ
K
We need…..We need…..
We need…..
We need…..
We need…..
We need…..
We need….
Managed Extensibility Framework
The Managed Extensibility Framework (MEF) is a new library in Silverlight 4 for building applications that can be incrementally extended.
> For customers> For you and your team > Always there, always ready
MEF Basics…An Application is built of
parts.
Hello MEF in Silverlight
Demo
MEF Basics…
Export it.
Import it.
Compose it.
Export it.
Widget1
[Export(typeof(UserControl))]public class Widget1 : UserControl{
public string Message { get{return(string) Button.Content;}
set{Button.Content=value;} }}
Export
UserControl
Import it.
Widget1
[Export(typeof(UserControl))]public class Widget1 : UserControl{
[Import]public string Message { get{return(string) Button.Content;}
set{Button.Content=value;} }}
Import
String
Import it.
Widget1
[Export(typeof(UserControl))]public class Widget1 : UserControl{
[Import(“HelloMEF.Message”)]public string Message { get{return(string) Button.Content;}
set{Button.Content=value;} }}
Import
“HelloMEF.Message”
Import it.
MainPage
[Export(typeof(UserControl))]public class MainPage: UserControl{
[ImportMany(typeof(UserControl))]public IEnumerable<UserControl> { get;set;}
}
ImportMany
UserControl
Compose it.
PartIntializer: “Compose yourself”
MainPage Compose
public MainPage() { InitializeComponent(); PartInitializer.SatisfyImports(this); }
Be different – Use metadata
Widget
Widget
Where does the widget
go?
Export it - Metadata
Widget1
[ExportMetadata(“Location”,Location.Top)][Export(typeof(UserControl))]public class Widget1 : UserControl{
public string Message { get{return(string) Button.Content;}
set{Button.Content=value;} }}
Export
UserControl
Put me in the top
Import it - Metadata
MainPage
[Export(typeof(UserControl))]public class MainPage: UserControl{
[ImportMany(typeof(UserControl))]public IEnumerable<Lazy<UserControl, IWidgetMetadata> { get;set;}
}
ImportMany
UserControl
Have it your way! – Custom Exports
Export it - Metadata
Widget1
[ExportMetadata(“Location”,Location.Top)][Export(typeof(UserControl))]public class Widget1 : UserControl{
public string Message { get{return(string) Button.Content;}
set{Button.Content=value;} }}
Export
UserControl
Put me in the top
Customize it – Custom exports
Widget1
[Widget(Location=Location.Top)]public class Widget1 : UserControl{
public string Message { get{return(string) Button.Content;}
set{Button.Content=value;} }}
Export
UserControl
Put me in the top
Putting it all together
Demo
Trim up your appsbreak up your XAPs
Demo
Introducing MEF-Prism integration
> Our Goal :
Enable an existing Prism application to be further extended through
MEF
> Enabled MEF modules to be added dynamically on the fly.
> Enable MEF discovered components to be registered in IoC container (Such as Unity).
Introducing MEF-Prism integration
> Prism application starts and loads up known modules.
Module Loader
Introducing MEF-Prism integration> Prism application can load unknown
plugins, by using MEF as an abstraction layer.
1. Plugins are located and added to a MEF catalog.
Server
Introducing MEF-Prism integration> Prism application can load unknown
plugins, by using MEF as an abstraction layer.
2. Plugins register dependencies with current IoC container.
Server
Introducing MEF-Prism integration> Prism application can load unknown
plugins, by using MEF as an abstraction layer.
3. Plugins are activated. Dependencies are injected.
Server
Where can I get it?
> MEF ships in Silverlight 4.0> Dynamic XAP support in SL 4.0 Toolkit> Silverlight 3.0 support on Codeplex> MEF source ships under MSPL
Learn more:Silverlight.netMEF.Codeplex.comMEFContrib.Codeplex.com – Prism/MEFblogs.msdn.com/gblock
YOUR FEEDBACK IS IMPORTANT TO US!
Please fill out session evaluation
forms online atMicrosoftPDC.com
Learn More On Channel 9
> Expand your PDC experience through Channel 9
> Explore videos, hands-on labs, sample code and demos through the new Channel 9 training courses
channel9.msdn.com/learnBuilt by Developers for Developers….
© 2009 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries.The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.