Mike Taulty MIX10 Silverlight Frameworks and Patterns
Upcoming SlideShare
Loading in...5
×
 

Mike Taulty MIX10 Silverlight Frameworks and Patterns

on

  • 3,124 views

Session slides from the MIX10 Silverlight workshop.

Session slides from the MIX10 Silverlight workshop.

Statistics

Views

Total Views
3,124
Views on SlideShare
3,106
Embed Views
18

Actions

Likes
0
Downloads
26
Comments
0

2 Embeds 18

http://www.slideshare.net 17
http://www.linkedin.com 1

Accessibility

Categories

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

Mike Taulty MIX10 Silverlight Frameworks and Patterns Mike Taulty MIX10 Silverlight Frameworks and Patterns Presentation Transcript

  • Silverlight 4frameworks, patterns
    Mike Taulty
    Microsoft Ltd
    @mtaulty
    mtaulty@microsoft.com
    http://mtaulty.com
  • capabilities
    need to know some or all of this depending on what you’re building
  • beyond capabilities
    *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)
    HTTP Request
    URL
    Resources
    VERB
    Res 1
    GET
    Payload
    Res 2
    POST
    PUT
    Res 3
    XML
    JSON
    DELETE
    Res 4
    XML
    JSON
    HTTP Response
    Status
    Payload
  • 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
    WCF Data Services
    Libraries
    DataModel
    • EntityFramework
    • LINQ to SQL
    • Custom
    request metadata
    LINQ Query
    generated proxy code
    metadata
    .NET OData Implementation
    WCF Data Services
    Libraries
    Windows Azure Storage
    Java
    PHP
    SharePoint
    WebSphere
    Atom
    implementation of odata
    for the client and the server
    “Other” OData Implementations
  • 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
    DomainService
    Stateless CRUD + App Logic
    class PlateViewDomainService
    IQueryable<Restaurant> GetRestaurants()
    IQueryable<Restaurant> SearchRestaurant(string)
    void AddRestaurant(Restaurant)
    Validation and authorization rules,
    Application workflows, …
    Data Model
    class Restaurant
    DomainContext
    Stateful view + Bindable Data
    class PlateViewDomainService
    EntityList<Restaurant> Books { get }
    EntityQuery<Restaurant> GetRestaurantQuery()
    EntityQuery<Restaurant> SearchRestaurantQuery(string)
    class Restaurant
    Data members + Validation
    Data Model +
    Metadata +
    Shared Code
    Services
    Rich Internet Application
    Presentation
    Logic
    Data Access Layer
    App
    Logic
    Network
    DomainContext
    Data
    Service
    DB
    Under the covers infrastructure
    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
    Page
    <UserControl>
    <Frame
    Source=“authors.xaml”/>
    authors.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()]
    books.xaml
  • navigation
    Page
    Frame displays a Page
    Page
    <UserControl>
    <Frame
    Source=“authors.xaml”/>
    authors.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 levelFrames not nested frames
    books.xaml
  • navigation
    navigate: http://booksite/default.aspx#/authors/steinbeck
    navigate: /authors/steinbeck
    Frame
    UriMapper
    ContentLoader
    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
    import
    (e.gDebuggerVisualizer)
    export
    (e.gDebuggerVisualizer)
    Component
    (e.g. Visual Studio)
    Component
    (e.g. XML Visualizer)
    MEF Composition Engine
    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
    initial, small download
    MyApp.xap
    Extras.xap
    additional functionality
  • 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 )
  • where are we?
    ASP.NET Client Application Services
    WCF Data Services
    WCF RIA Services
    navigation & search
    extensible applications with MEF
    Model View ViewModel (MVVM)
  • why MVVM?
    View
    Silverlight client
    web
    data
  • why MVVM?
    needs to be designable
    “where does the DisplayDetail flag go?”
    Data/
    Service
    Layer
    View
    (e.g. Person Master/Details)
    Model
    (e.g. PeopleModel)
    Code
    XAML
    Person
    Business
    Layer
    View
    model
    needs to be testable and maintainable
    Silverlight client
  • why MVVM?
    Open to techniques like
    dependency injection,
    mocking to aid testability
    ViewModel is the View’s
    DataContext.
    Bind to data, commands
    ViewModel
    Designers & Design
    Tools like XAML so
    maximize its use
    View
    (e.g. Person Master/Details)
    bridges the gap
    Model
    (e.g. PeopleModel/Person)
    XAML
    Code
    Hard to test this
    code without UI so
    minimize/remove
    pure “Data”
    pure “Display”
  • commands
    ICommandseparates UI from functionality
    No ICommand implementation in Silverlight 4 but some controls make use of ICommand
    No need for the Button to be aware of the code that handles this Command
  • triggers, actions, behaviors
    Blend team’s simple concepts -> powerful results
    attach/detach yourself to/from
    any DependencyObject
    Trigger = START SOMETHING
    Action == DO SOMETHING
    Behavior == GET OUT OF JAIL FREE
  • triggers, actions, behaviors
    In the Blend SDK
    Microsoft.Expressions.Interactions.dll
    System.Windows.Interactivity.dll
    On CodePlex(expressionblend.codeplex.com)
    Expression.Samples.Interactivity.dll
    and lots more out there
    e.g. Expression Gallery
    Actions
    Triggers
    Behavors
    • KeyTrigger
    • TimerTrigger
    • DataEventTrigger
    • DataTrigger
    • MouseGestureTrigger
    • PropertyChangedTrigger
    • StateChanged
    • MouseEventTrigger
    • StoryboardCompletedTrigger
    • CallMethod
    • ChangePropertyAction
    • InvokeCommandAction
    • CallDataMethod
    • InvokeDataCommand
    • SetDataProperty
    • GoToStateAction
    • GoToNextState
    • GoToPreviousState
    • ListBoxAddOne
    • ListBoxRemoveOne
    • ListBoxRemoveThisItem
    • RemoveElementAction
    • PauseMedia
    • PlayMedia
    • RewindMedia
    • SetProperty
    • StopMedia
    • TogglePlayPauseMedia
    • ShowMessageBox
    • HyperlinkAction
    • PlaySoundAction
    • ControlStoryboardAction
    • ClippingBehavior
    • DataStateBehavior
    • DataStateSwitchBehavior
    • FluidBindBehavior
    • FluidMoveBehavior
    • MouseDragElementBehavior
  • MVVM
    “Main View”
    Binds to MainViewModel
    ( surfaces enumerable Views )
    “Filter View”
    Binds to FilteredProductsViewModel
    “Products View”
    Binds to FilteredProductsViewModel
    ( surfaces enumerable ProductViewModel )
    “Product View”
    Binds to ProductViewModel
  • enough hot air, do a demo
    MVVM, commands and actions
  • MEF
    Understanding the MVVM Pattern
    Build your own MVVM Framework
    Laurent Bugnion &
    Rob Eisenberg
    Monday 2pm
    Monday 3.30pm
    Lagoon DEF
    ( check 2 B sure )
  • resources
    www.silverlight.tv
    www.silverlight.net
  • feedback
  • © 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.