KEMBAR78
Mike Taulty MIX10 Silverlight 4 Patterns Frameworks | PDF
Silverlight 4
                        frameworks, patterns


Mike Taulty
Microsoft Ltd
@mtaulty
mtaulty@microsoft.com
http://mtaulty.com
capabilities
                               graphics

             browser
                                                  need to know some or all
                                                   media


                                                  of this depending on what
   local
  machine
                                                  you’re building
                                                          layout




network                                                         styling




      controls                                        binding



                   animation              resources
beyond capabilities

                                                rich
                                      internet
    ASP.NET Client Application Services
                                            application
    WCF Data Services

    WCF RIA Services

    navigation

    search

    extensible applications with MEF
                        patterns                                  frameworks

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

ASP.NET Client Application Services

WCF Data Services

WCF RIA Services

navigation

search

extensible applications with MEF
ASP.NET Client App Services

• ASP.NET services available to Silverlight clients

                                        ASP.NET
                                        membership
                                        roles
                                        profiles
                   no specific client libraries here, just add a
                   reference and make the call
enough hot air, do a demo

ASP.NET Services from Silverlight
where are we?

ASP.NET Client Application Services

WCF Data Services

WCF RIA Services

navigation

search

extensible applications with MEF
RESTful services (in general)

                                            Resources
          HTTP Request
URL                                              Res 1
VERB        GET                                  Res 2
Payload     POST                                 Res 3
            PUT                                  Res 4
  XML     JSON
           DELETE



           HTTP Response
                           Status
                           Payload


                            XML      JSON
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
WCF Data Services ( “Astoria” )

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




                                     metadata
                                         Atom




implementation of odata
for the client and the server
enough hot air, do a demo

WCF Data Services from Silverlight
WCF Data Services
oData – There’s a Feed for That
oData – How to Create a Feed for That
To learn about OData go to
Pablo/Mike’s talks
Tuesday 11.30am
Lagoon L
Tuesday 3pm
Breakers H
( check 2 B sure )
where are we?

ASP.NET Client Application Services

WCF Data Services

WCF RIA Services

navigation

search

extensible applications with MEF
WCF RIA Services
 DomainContext                                                                 DomainService
 Stateful view + Bindable Data                                                 Stateless CRUD + App Logic
      class PlateViewDomainService                                                   class PlateViewDomainService
      EntityList<Restaurant> Books { get }                      Data Model +         IQueryable<Restaurant> GetRestaurants()
      EntityQuery<Restaurant> GetRestaurantQuery()                                   IQueryable<Restaurant> SearchRestaurant(string)
      EntityQuery<Restaurant> SearchRestaurantQuery(string)
                                                                 Metadata +
                                                                Shared Code          void AddRestaurant(Restaurant)
      class Restaurant                                                               Validation and authorization rules,
      Data members + Validation                                                    Application workflows, …

                                                                               Data Model
                                                                                   class Restaurant




                                            Rich Internet Application                                                    Services


      Presentation           Domain         Network
                                                               Data         App              Data Access
         Logic               Context                          Service
                                                                           Logic                Layer

                                 Under the covers infrastructure
                                                                                                                             DB

Note: Slide stolen from Brad Abrams
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
enough hot air, do a demo

WCF RIA Services
WCF RIA Services
Developing with WCF RIA Services
Quickly & Effectively
To learn about WCF RIA Services
go to Nikhil Kothari’s talk
Tuesday 1:30pm
Lagoon H
( check 2 B sure )
where are we?

ASP.NET Client Application Services

WCF Data Services

WCF RIA Services

navigation

search

extensible applications with MEF
navigation
                                     Page
• Frame displays a Page
                                      authors.xaml
  <UserControl>                                      Page
   <Frame
    Source=“authors.xaml”/>
                                                     books.xaml




• 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()]
navigation
                                          Page
• Frame displays a Page
                                           authors.xaml
  <UserControl>                                           Page
   <Frame
    Source=“authors.xaml”/>
                                                          books.xaml




• 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
navigation
      navigate:             http://booksite/default.aspx#/authors/steinbeck
      navigate:             /authors/steinbeck


              Frame


          UriMapper                                            ContentLoader
Uri                 MappedUri

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

/{pageName}         /views/{pagename.xaml}
                                                           Asynchronously turns the URI
                                                           into a Page or UserControl
enough hot air, do a demo

Navigation Framework in Silverlight 4
where are we?

ASP.NET Client Application Services

WCF Data Services

WCF RIA Services

navigation

search

extensible applications with MEF
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
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”
WCF RIA Services
Search Engine Optimization for MS
Silverlight
To learn more about SEO go
to Brad Abrams’ talk
Wednesday 12.00
Lagoon B
( check 2 B sure )
where are we?

ASP.NET Client Application Services

WCF Data Services

WCF RIA Services

navigation

search

extensible applications with MEF
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 )
essential MEF



                          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
one application of MEF


                          MyApp.xap

initial, small download


                           Extras.xap
enough hot air, do a demo

the Managed Extensibility Framework
MEF
Silverlight Optimization &
Extensibility with MEF
To really learn about MEF go
along to Glenn Block’s talk
Tuesday, 3.35pm
Lagoon B
( check 2 B sure )
resources




www.silverlight.tv   www.silverlight.net
feedback


eval forms on seat

fill them in 
• ideally, after we’ve finished

tweet @mtaulty, @john_papa
© 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.

Mike Taulty MIX10 Silverlight 4 Patterns Frameworks

  • 1.
    Silverlight 4 frameworks, patterns Mike Taulty Microsoft Ltd @mtaulty mtaulty@microsoft.com http://mtaulty.com
  • 2.
    capabilities graphics browser need to know some or all media of this depending on what local machine you’re building layout network styling controls binding animation resources
  • 3.
    beyond capabilities rich internet ASP.NET Client Application Services application WCF Data Services WCF RIA Services navigation search extensible applications with MEF patterns frameworks *lots of other Silverlight frameworks, libraries, patterns out there – sorry if I missed your favorite
  • 4.
    where are we? ASP.NETClient Application Services WCF Data Services WCF RIA Services navigation search extensible applications with MEF
  • 5.
    ASP.NET Client AppServices • ASP.NET services available to Silverlight clients ASP.NET membership roles profiles no specific client libraries here, just add a reference and make the call
  • 6.
    enough hot air,do a demo ASP.NET Services from Silverlight
  • 7.
    where are we? ASP.NETClient Application Services WCF Data Services WCF RIA Services navigation search extensible applications with MEF
  • 8.
    RESTful services (ingeneral) Resources HTTP Request URL Res 1 VERB GET Res 2 Payload POST Res 3 PUT Res 4 XML JSON DELETE HTTP Response Status Payload XML JSON
  • 9.
    odata • Open DataProtocol ( 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
  • 10.
    WCF Data Services( “Astoria” ) http://server/customers(‘alfki’)/Orders?$top=20 metadata Atom implementation of odata for the client and the server
  • 11.
    enough hot air,do a demo WCF Data Services from Silverlight
  • 12.
    WCF Data Services oData– There’s a Feed for That oData – How to Create a Feed for That To learn about OData go to Pablo/Mike’s talks Tuesday 11.30am Lagoon L Tuesday 3pm Breakers H ( check 2 B sure )
  • 13.
    where are we? ASP.NETClient Application Services WCF Data Services WCF RIA Services navigation search extensible applications with MEF
  • 14.
    WCF RIA Services DomainContext DomainService Stateful view + Bindable Data Stateless CRUD + App Logic class PlateViewDomainService class PlateViewDomainService EntityList<Restaurant> Books { get } Data Model + IQueryable<Restaurant> GetRestaurants() EntityQuery<Restaurant> GetRestaurantQuery() IQueryable<Restaurant> SearchRestaurant(string) EntityQuery<Restaurant> SearchRestaurantQuery(string) Metadata + Shared Code void AddRestaurant(Restaurant) class Restaurant Validation and authorization rules, Data members + Validation Application workflows, … Data Model class Restaurant Rich Internet Application Services Presentation Domain Network Data App Data Access Logic Context Service Logic Layer Under the covers infrastructure DB Note: Slide stolen from Brad Abrams
  • 15.
    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
  • 16.
    enough hot air,do a demo WCF RIA Services
  • 17.
    WCF RIA Services Developingwith WCF RIA Services Quickly & Effectively To learn about WCF RIA Services go to Nikhil Kothari’s talk Tuesday 1:30pm Lagoon H ( check 2 B sure )
  • 18.
    where are we? ASP.NETClient Application Services WCF Data Services WCF RIA Services navigation search extensible applications with MEF
  • 19.
    navigation Page • Frame displays a Page authors.xaml <UserControl> Page <Frame Source=“authors.xaml”/> books.xaml • 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()]
  • 20.
    navigation Page • Frame displays a Page authors.xaml <UserControl> Page <Frame Source=“authors.xaml”/> books.xaml • 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
  • 21.
    navigation navigate: http://booksite/default.aspx#/authors/steinbeck navigate: /authors/steinbeck Frame UriMapper ContentLoader Uri MappedUri /authors/{author} /views/authors.xaml?surname={author} /{pageName} /views/{pagename.xaml} Asynchronously turns the URI into a Page or UserControl
  • 22.
    enough hot air,do a demo Navigation Framework in Silverlight 4
  • 23.
    where are we? ASP.NETClient Application Services WCF Data Services WCF RIA Services navigation search extensible applications with MEF
  • 24.
    search • search enginesvisiting 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
  • 25.
    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”
  • 26.
    WCF RIA Services SearchEngine Optimization for MS Silverlight To learn more about SEO go to Brad Abrams’ talk Wednesday 12.00 Lagoon B ( check 2 B sure )
  • 27.
    where are we? ASP.NETClient Application Services WCF Data Services WCF RIA Services navigation search extensible applications with MEF
  • 28.
    extensible applications withMEF • 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 )
  • 29.
    essential MEF 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
  • 30.
    one application ofMEF MyApp.xap initial, small download Extras.xap
  • 31.
    enough hot air,do a demo the Managed Extensibility Framework
  • 32.
    MEF Silverlight Optimization & Extensibilitywith MEF To really learn about MEF go along to Glenn Block’s talk Tuesday, 3.35pm Lagoon B ( check 2 B sure )
  • 33.
    resources www.silverlight.tv www.silverlight.net
  • 34.
    feedback eval forms onseat fill them in  • ideally, after we’ve finished tweet @mtaulty, @john_papa
  • 35.
    © 2010 MicrosoftCorporation. 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.