mike taulty mix10 silverlight frameworks and patterns

35
Silverlight 4 frameworks, patterns Mike Taulty Microsoft Ltd @mtaulty [email protected] http://mtaulty.com

Upload: ukdpe

Post on 07-Nov-2014

3.204 views

Category:

Education


3 download

DESCRIPTION

Session slides from the MIX10 Silverlight workshop.

TRANSCRIPT

Page 1: Mike Taulty MIX10 Silverlight Frameworks and Patterns

Silverlight 4frameworks, patterns

Mike TaultyMicrosoft Ltd@[email protected]://mtaulty.com

Page 2: Mike Taulty MIX10 Silverlight Frameworks and Patterns

capabilities

graphics

media

layout

styling

binding

resourcesanimation

controls

network

local machine

browser need to know some or all of this depending on what you’re building

Page 3: Mike Taulty MIX10 Silverlight Frameworks and Patterns

beyond capabilities

richinternet

application

frameworkspatterns

ASP.NET Client Application Services

WCF Data Services

WCF RIA Services

navigation

search

extensible applications with MEF

*lots of other Silverlight frameworks, libraries, patterns out there – sorry if I missed your favorite

Page 4: Mike Taulty MIX10 Silverlight Frameworks and Patterns

where are we?

ASP.NET Client Application Services

WCF Data Services

WCF RIA Services

navigation

search

extensible applications with MEF

Page 5: Mike Taulty MIX10 Silverlight Frameworks and Patterns

ASP.NET Client App Services

• ASP.NET services available to Silverlight clients

ASP.NETmembershiproles

profiles

no specific client libraries here, just add a reference and make the call

Page 6: Mike Taulty MIX10 Silverlight Frameworks and Patterns

enough hot air, do a demo

ASP.NET Services from Silverlight

Page 7: Mike Taulty MIX10 Silverlight Frameworks and Patterns

where are we?

ASP.NET Client Application Services

WCF Data Services

WCF RIA Services

navigation

search

extensible applications with MEF

Page 8: Mike Taulty MIX10 Silverlight Frameworks and Patterns

RESTful services (in general)

Resources

Res 1

Res 2

Res 3

Res 4

HTTP RequestURL

VERBPayload

HTTP Response Status

GETPOSTPUT

DELETEXML JSON

Payload

XML JSON

Page 9: Mike Taulty MIX10 Silverlight Frameworks and Patterns

odata

• Open Data Protocol ( odata )– www.odata.org – published under the Open Specification Promise

• Extends the AtomPub standard to add– an addressing scheme– a mechanism for schema– alternate representation – JSON– handling for concurrent updates– handling for batched requests

Page 10: Mike Taulty MIX10 Silverlight Frameworks and Patterns

WCF Data Services ( “Astoria” )

implementation of odata for the client and the server

request metadatametadata

WCF Data ServicesLibraries

generated proxy code

WCF Data ServicesLibraries

DataModel• EntityFramework• LINQ to SQL• Custom

LINQ Query

Windows Azure StorageJavaPHPSharePointWebSphere

“Other” OData Implementations

.NET OData Implementation

http://server/customers(‘alfki’)/Orders?$top=20

Atom

Page 11: Mike Taulty MIX10 Silverlight Frameworks and Patterns

enough hot air, do a demo

WCF Data Services from Silverlight

Page 12: Mike Taulty MIX10 Silverlight Frameworks and Patterns

WCF Data Services

To learn about OData go to Pablo/Mike’s talks

oData – There’s a Feed for ThatoData – How to Create a Feed for That

Tuesday 11.30amLagoon L

Tuesday 3pmBreakers H( check 2 B sure )

Page 13: Mike Taulty MIX10 Silverlight Frameworks and Patterns

where are we?

ASP.NET Client Application Services

WCF Data Services

WCF RIA Services

navigation

search

extensible applications with MEF

Page 14: Mike Taulty MIX10 Silverlight Frameworks and Patterns

WCF RIA Services

DomainServiceStateless CRUD + App Logic

class PlateViewDomainServiceIQueryable<Restaurant> GetRestaurants()IQueryable<Restaurant> SearchRestaurant(string)void AddRestaurant(Restaurant)Validation and authorization rules,

Application workflows, …

Data Model class Restaurant

DomainContextStateful view + Bindable Data

class PlateViewDomainServiceEntityList<Restaurant> Books { get }EntityQuery<Restaurant> GetRestaurantQuery()EntityQuery<Restaurant> SearchRestaurantQuery(string)

class RestaurantData members + Validation

Data Model +Metadata +

Shared Code

Rich Internet Application

DB

Services

Data Access Layer

AppLogic

Presentation

Logic

Network

DomainContex

t

DataServic

e

Under the covers infrastructure

Note: Slide stolen from Brad Abrams

Page 15: Mike Taulty MIX10 Silverlight Frameworks and Patterns

WCF RIA Services

• WCF RIA Services (fka .NET RIA Services)You’re building an application– You’re responsible for both server and client deep in

business logic and semantics

• WCF Data Services (fka “Astoria”)You’re exposing/acquiring data– You control one side or the other, not both– CRUD among arbitrary producers / consumers logic and

semantics are invisible

NB: Slide stolen from Brad Abrams

Page 16: Mike Taulty MIX10 Silverlight Frameworks and Patterns

enough hot air, do a demo

WCF RIA Services

Page 17: Mike Taulty MIX10 Silverlight Frameworks and Patterns

WCF RIA Services

To learn about WCF RIA Services go to Nikhil Kothari’s talk

Developing with WCF RIA ServicesQuickly & Effectively

Tuesday 1:30pmLagoon H( check 2 B sure )

Page 18: Mike Taulty MIX10 Silverlight Frameworks and Patterns

where are we?

ASP.NET Client Application Services

WCF Data Services

WCF RIA Services

navigation

search

extensible applications with MEF

Page 19: Mike Taulty MIX10 Silverlight Frameworks and Patterns

navigation

• Frame displays a Page

<UserControl> <Frame Source=“authors.xaml”/>

authors.xaml

Page

books.xaml

Page

• navigation between pages– call Frame.Navigate() or set the Source property– or use a HyperlinkButton ( NavigateUri/TargetName )

• navigation history– call Frame.[Can]Go[Back()/Forward()]

Page 20: Mike Taulty MIX10 Silverlight Frameworks and Patterns

navigation

• navigation can integrate with the browser– enables hyperlinking into Silverlight content– requires a browser!– requires a hidden iframe on the hosting page– for top level Frames not nested frames

<UserControl> <Frame Source=“authors.xaml”/>

authors.xaml

Page

books.xaml

Page

• Frame displays a Page

Page 21: Mike Taulty MIX10 Silverlight Frameworks and Patterns

navigation

navigate: http://booksite/default.aspx#/authors/steinbecknavigate: /authors/steinbeck

Frame

UriMapper ContentLoader

Asynchronously turns the URI into a Page or UserControl

Uri MappedUri

/authors/{author} /views/authors.xaml?surname={author}

/{pageName} /views/{pagename.xaml}

Page 22: Mike Taulty MIX10 Silverlight Frameworks and Patterns

enough hot air, do a demo

Navigation Framework in Silverlight 4

Page 23: Mike Taulty MIX10 Silverlight Frameworks and Patterns

where are we?

ASP.NET Client Application Services

WCF Data Services

WCF RIA Services

navigation

search

extensible applications with MEF

Page 24: Mike Taulty MIX10 Silverlight Frameworks and Patterns

search

• search engines visiting a page with Silverlight– read robots.txt and sitemap– read/index the page title– read/index the <meta name=“description”/>– read/index the surrounding HTML ( if any )– will not read XAP or dynamic Silverlight content

• approach– alternate content in the <object/> tag– for both search engines & down-level clients

Page 25: Mike Taulty MIX10 Silverlight Frameworks and Patterns

enough hot air, do a demo

offering alternate content to search

note – I stole this demo, it comes from the WCF RIA Services Code Gallery and is called “Silverlight Store”

Page 26: Mike Taulty MIX10 Silverlight Frameworks and Patterns

WCF RIA Services

To learn more about SEO go to Brad Abrams’ talk

Search Engine Optimization for MS Silverlight

Wednesday 12.00Lagoon B( check 2 B sure )

Page 27: Mike Taulty MIX10 Silverlight Frameworks and Patterns

where are we?

ASP.NET Client Application Services

WCF Data Services

WCF RIA Services

navigation

search

extensible applications with MEF

Page 28: Mike Taulty MIX10 Silverlight Frameworks and Patterns

extensible applications with MEF

• the Managed Extensibility Framework– “an extensible framework for composing

applications from a set of loosely-coupled parts discovered and evolving at run-time“ (mike)

• versions– .NET Framework shipping with Silverlight 4 – .NET Framework 4 shipping with VS 2010– Silverlight 3 & .NET Framework V3.5 Sp1 ( from

source on CodePlex )

Page 29: Mike Taulty MIX10 Silverlight Frameworks and Patterns

essential MEF

Component(e.g. Visual Studio)

import(e.g DebuggerVisualizer)

Component(e.g. XML Visualizer)

export(e.g DebuggerVisualizer)

MEF Composition Engine

Compose

• MEF discovers exports via catalogs– several “in box” catalogs plus many extensibility points– supports available exports changing at runtime

• and/or can be handed component instances

Page 30: Mike Taulty MIX10 Silverlight Frameworks and Patterns

one application of MEF

MyApp.xap

initial, small download

Extras.xapadditional functionality

Page 31: Mike Taulty MIX10 Silverlight Frameworks and Patterns

enough hot air, do a demo

the Managed Extensibility Framework

Page 32: Mike Taulty MIX10 Silverlight Frameworks and Patterns

MEF

To really learn about MEF go along to Glenn Block’s talk

Silverlight Optimization & Extensibility with MEF

Tuesday, 3.35pmLagoon B( check 2 B sure )

Page 33: Mike Taulty MIX10 Silverlight Frameworks and Patterns

resources

www.silverlight.tv www.silverlight.net

Page 34: Mike Taulty MIX10 Silverlight Frameworks and Patterns

feedback

eval forms on seat

fill them in • ideally, after we’ve finished

tweet @mtaulty, @john_papa

Page 35: Mike Taulty MIX10 Silverlight Frameworks and Patterns

© 2010 Microsoft Corporation. All rights reserved. Microsoft, Windows, 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.