+ All Categories
Home > Education > Mike Taulty DevDays 2010 Silverlight MEF

Mike Taulty DevDays 2010 Silverlight MEF

Date post: 06-May-2015
Category:
Upload: ukdpe
View: 1,330 times
Download: 1 times
Share this document with a friend
25
Change the Rules Silverlight 4 – A Guided Tour of MEF Mike Taulty, Microsoft UK [email protected] mtaulty.com @mtaulty
Transcript
Page 1: Mike Taulty DevDays 2010 Silverlight MEF

Change the Rules

Silverlight 4 – A Guided Tour of MEF

Mike Taulty, Microsoft UK [email protected] mtaulty.com @mtaulty

Page 2: Mike Taulty DevDays 2010 Silverlight MEF

MEF – What is it? How and when do I get it?

• the Managed Extensibility Framework

– an extensible framework for composing applications from a set of loosely-coupled parts discovered and evolving at run-time

• versions

– .NET Framework shipping with Silverlight 4

– .NET Framework 4 shipping with VS 2010

– CodePlex version for Silverlight 3, .NET 3.5 Sp1

Page 3: Mike Taulty DevDays 2010 Silverlight MEF

“scenario”

AlbumArtProvider

Page 4: Mike Taulty DevDays 2010 Silverlight MEF

Change the Rules

demo using MEF in our scenario

Page 5: Mike Taulty DevDays 2010 Silverlight MEF

MEF models composable parts

Page 6: Mike Taulty DevDays 2010 Silverlight MEF

MEF composes parts

Compose

Page 7: Mike Taulty DevDays 2010 Silverlight MEF

which parts compose together?

Contract

Name

Cardinality

Shared

Recomposable

Metadata

Contract

Name

Shared

Metadata

Page 8: Mike Taulty DevDays 2010 Silverlight MEF

Change the Rules

demo matching imports to exports

Page 9: Mike Taulty DevDays 2010 Silverlight MEF

parts & part definitions

• PartDefinition is a blueprint for a Part

– similar to Object and Type in .NET

– but can have Part without PartDefinition

Page 10: Mike Taulty DevDays 2010 Silverlight MEF

container draws parts from catalogs

Page 11: Mike Taulty DevDays 2010 Silverlight MEF

or mix in pre-instantiated parts

Page 12: Mike Taulty DevDays 2010 Silverlight MEF

Change the Rules

demo the built-in catalogs* (* one is missing, we’ll come back to it later )

Page 13: Mike Taulty DevDays 2010 Silverlight MEF

things change - recomposition

Page 14: Mike Taulty DevDays 2010 Silverlight MEF

recomposition is key for Silverlight

MyApp.xap

Extras.xap

Page 15: Mike Taulty DevDays 2010 Silverlight MEF

Change the Rules

demo recomposition & DeploymentCatalog ( completing our story of built-in catalogs )

Page 16: Mike Taulty DevDays 2010 Silverlight MEF

stable composition

reject parts with unsatisfied imports

Page 17: Mike Taulty DevDays 2010 Silverlight MEF

Change the Rules

demo stable composition

Page 18: Mike Taulty DevDays 2010 Silverlight MEF

MEF and Model View ViewModel

• Strong separation of concerns possible with Silverlight development – user interface declared in XAML

– loosely binds to data

– functionality invoked by declarative commands

• Encapsulated by the “MVVM” pattern

commands

binding

Page 19: Mike Taulty DevDays 2010 Silverlight MEF

Change the Rules

demo MEF and MVVM

Page 20: Mike Taulty DevDays 2010 Silverlight MEF

Change the Rules

Pointers to more advanced topics

Page 21: Mike Taulty DevDays 2010 Silverlight MEF

extensibility – catalogs & export providers

Page 22: Mike Taulty DevDays 2010 Silverlight MEF

MEF Primitives

extensibility – programming models

• Programming models

in MEF are pluggable

• [Attribute] is the

built-in model

• Custom models involve

implementing some/all of

MEF’s primitive classes

ComposablePartCatalog

ComposablePartDefinition

ComposablePart

ExportDefinition

ImportDefinition

Page 23: Mike Taulty DevDays 2010 Silverlight MEF

resources

• Channel 9 Silverlight 4 MEF Screencasts – channel9.msdn.com/tags/learnMEFSL4

• Glenn Block – blogs.msdn.com/gblock

• Nicholas Blumhardt – blogs.msdn.com/nblumhardt

• MEF on CodePlex – mef.codeplex.com

Page 24: Mike Taulty DevDays 2010 Silverlight MEF

thank you

© 2010 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.

Page 25: Mike Taulty DevDays 2010 Silverlight MEF

Change the Rules

Silverlight 4 – A Guided Tour of MEF

Mike Taulty, Microsoft UK [email protected] mtaulty.com @mtaulty


Recommended