Data-Driven Services with Silverlight 2

Book description

This comprehensive book teaches you how to build data-rich business applications with Silverlight 2 that draw on multiple sources of data. Packed with reusable examples, Data-Driven Services with Silverlight 2 covers all of the data access and web service tools you need, including data binding, the LINQ data querying component, RESTful and SOAP web service support, cross-domain web service calls, and Microsoft's new ADO.NET Data Services and the ADO.NET Entity Framework.

With this book, you will:



  • Know when and how to use LINQ to JSON, LINQ to XML, and LINQ to Objects
  • Learn how Silverlight 2 applications bind, pass, read, save, query, and present data
  • Discover how your application can call web services to work with SOAP, REST, RSS, AtomPub, POX and JSON
  • Design REST, ASMX, and WCF web services that communicate with Silverlight 2
  • Harness RESTful web services such as Digg, Amazon, and Twitter
  • Retrieve and save data using the new Entity Framework and WCF
  • Work with RESTful ADO.NET Data Services and its Silverlight client library to move data between your Silverlight application and a database



Data-Driven Services with Silverlight 2 offers many tips and tricks for building data-rich business applications, and covers the scenarios you're most likely to encounter. Complete examples in C# and VB can be downloaded from the book's companion website.

Publisher resources

View/Submit Errata

Table of contents

  1. Data-Driven Services with Silverlight 2
    1. SPECIAL OFFER: Upgrade this ebook with O’Reilly
    2. A Note Regarding Supplemental Files
    3. Foreword
    4. Preface
      1. Silverlight Backdrop
      2. Who Should Read This Book
      3. Why You Should Read This Book
      4. What This Book Will Cover
      5. Problems This Book Solves for Readers
      6. How This Book Is Organized
        1. What You Need to Use This Book
      7. Conventions Used in This Book
      8. Using Code Examples
        1. Accompanying Website
        2. Templates
      9. Safari® Books Online
      10. Comments and Questions
      11. Acknowledgments
    5. 1. Getting Started with Silverlight 2
      1. The Importance of Data Access
      2. Jumping In
      3. Silverlight 2 Features
        1. Framework Languages and .NET Support
        2. Self-Describing Data Services
        3. Loose Coupling with Data Services
        4. Control Model
        5. LINQ to Objects and LINQ to XML
      4. LINQ
      5. Language Enhancements
        1. Automatic Properties in C#
        2. Object Initializers
        3. Collection Initializers
        4. Extension Methods
        5. Implicitly Typed Variables
        6. Anonymous Types/Implicit Types
        7. Anonymous Types and LINQ
      6. Summary
    6. 2. Silverlight Data-Binding Foundations
      1. Life Without Binding
      2. Data Binding in Silverlight
        1. Rule 1: FrameworkElement
        2. Rule 2: Dependency Properties
      3. XAML’s Binding Markup Extensions
        1. Binding Extension Properties
        2. Simplified Binding
      4. Runtime Binding
        1. Creating Runtime Bindings
        2. Removing a Binding
      5. DataContext
        1. DataContext and Source
        2. DataContext Propagation
      6. Binding in Blend
      7. Summary
    7. 3. Modes and Notifications
      1. Binding Modes
        1. OneTime
        2. OneWay
        3. TwoWay
        4. Modes Without Notifications
        5. To Notify or Not to Notify
      2. Notifications
        1. Implementing the INotifyPropertyChanged Interface
        2. Adding Notifications
        3. Refactoring Options
      3. Summary
    8. 4. Managing Lists, Templates, and Converters
      1. Binding to List-Based Controls
        1. Setting the ItemsSource
        2. Binding Mode Considerations
      2. Templates and Rows
        1. DataTemplates As Resources
        2. Complex DataTemplates
      3. Item Selection
        1. Using Different Binding Modes
      4. Lists and Notifications
        1. ObservableCollection<T>
        2. Changing a List<T>
        3. Changing an ObservableCollection<T>
      5. Converters
        1. IValueConverter
        2. Conversions
          1. DateTime conversions
          2. Currency conversions
      6. Summary
    9. 5. WCF, Web Services, and Cross-Domain Policies
      1. ASMX Web Services
      2. Creating an ASMX Web Service
        1. Getting Started with the Example
        2. Creating the ASMX Web Service
      3. Referencing an ASMX Web Service
        1. Returning ObservableCollection<T>
      4. Consuming an ASMX Web Service
        1. Bindings Again
        2. Creating a Proxy
        3. Asynchronous Invocation
        4. Asynchronous Completion
        5. Running the ASMX Web Service
      5. Cross-Domain Calls and Policies
        1. Understanding Cross-Domain Restrictions
        2. Crossing the Boundary
        3. Watching the Requests
        4. Silverlight Policy File
        5. The crossdomain.xml File
        6. Cross-Domain Summary
      6. Creating a Silverlight-Enabled WCF Service
        1. Creating the WCF Web Service
        2. Bindings
        3. WCF Service Setup
        4. Invoking the WCF Service
      7. Calling Services Written by Other Developers
      8. Summary
    10. 6. Passing Entities via WCF
      1. Passing Entities Between Physical Tiers
        1. Domain Model Entities
        2. Silverlight and Entities
        3. Serialization by Default
        4. Serialization Attributes
        5. Putting It Together
          1. Configuration changes
          2. Getting and saving
      2. Using LINQ to SQL with Silverlight
        1. LINQ to SQL Entity Serialization
        2. Creating Entities with LINQ to SQL
        3. Serving the LINQ to SQL Model
        4. Consuming LINQ to SQL Entities from Silverlight
      3. Silverlight and the Entity Framework
        1. Creating the Entity Framework Model
        2. Consuming Entity Framework Entities from Silverlight
      4. Summary
    11. 7. Consuming RESTful Services with WebClient and HttpWebRequest
      1. RESTful Primer
        1. Basic HTTP Web Requests
        2. RESTful Web Services Provide Resources
        3. Unique URIs
        4. Anatomy of a RESTful Service
          1. URI templates and parameters (as created through WCF)
          2. Actions and responses
      2. WebClient
        1. Preparing to Consume a RESTful Service with WebClient
      3. Invoking a RESTful Service with WebClient
        1. Creating the XAML for the UI
        2. Invoking the Service with WebClient
        3. Consuming the Response with LINQ to XML
        4. Measuring Progress
      4. HttpWebRequest
        1. HttpWebRequest in Action
        2. Working with the Callback
        3. Crossing Threads
        4. Threading with WebClient and HttpWebRequest
      5. Summary
    12. 8. Consuming Amazon’s RESTful Services with Silverlight 2
      1. Data in the Cloud
      2. Creating an Amazon Shopping Cart
        1. RESTful Actions
        2. Searching for Books
        3. Parsing Books with LINQ to XML
        4. Binding the Search Results
        5. Cart Operations
      3. Summary
    13. 9. Creating RESTful Services and Introducing SilverTwit
      1. Creating RESTful Services from WCF
        1. Creating a RESTful Service
        2. Creating the Service Interface
        3. Configuring a RESTful Service
        4. Defining the Contract
        5. Consuming the REST-Friendly Service
        6. Default Values
        7. HTTP Status Codes
      2. Servicing JSON
        1. Defining a JSON Response
        2. LINQ to JSON
        3. Consuming Products Using LINQ to JSON
        4. Serialized JSON
      3. Posting Data to a RESTful Service
        1. Defining POST Methods
        2. Posting JSON and XML
      4. Case Study: SilverTwit
        1. SilverTwit Architecture
        2. SilverTwit UI
        3. SilverTwitWS RESTful Web Service
        4. Caching
        5. Tweeting
      5. Summary
    14. 10. Syndication Feeds and Silverlight 2
      1. Syndicated Feeds
      2. Requesting a Feed
      3. Reading a Feed
        1. Binding a Feed
        2. Converters
      4. Cross-Domain Policies
      5. Aggregating Feeds
      6. Summary
    15. 11. Silverlight 2 and ADO.NET Data Services
      1. ADO.NET Data Services Overview
        1. HTTP Methods
        2. Message Formats
        3. Metadata
      2. Services over Custom Data Sources
        1. Access Rules
        2. RESTful Addressing
        3. URI Options
        4. Creating the Proxy Class
        5. Async LINQ
      3. ADO.NET Data Services over the Entity Framework
        1. Creating Services on an Entity Data Model
        2. Read Access
        3. Extending the Client Model
          1. Eager loading
          2. Loading asynchronously
          3. Enabling saves
        4. The Client Hookup
          1. Loading and linking
        5. Notification Implications
        6. Delayed Loading
        7. Query Interceptors
        8. Change Interceptors
        9. Extending the Service Operations
      4. More Saving Options
        1. Inserts and Object Graphs
        2. Optimistic Concurrency
      5. Summary
    16. A. ADO.NET Data Services Quick Reference
      1. HTTP Methods
      2. System.Data.Services.Client
      3. System.Data.Services
      4. ADO.NET Data Services URI Options
      5. ADO.NET Data Services URI Operators
      6. ADO.NET Data Services URI Functions
    17. B. Silverlight 2 Debugging with HTTP Sniffing Tools
      1. Fiddler2
        1. Capturing Traffic
        2. Executing Requests in Fiddler2
        3. Inspecting Requests/Responses in Fiddler2
        4. Watching Localhost Requests
          1. IPv6
          2. Using Fiddler2 to capture browser traffic in Firefox
      2. Web Development Helper
        1. Cross-domain debugging
      3. Firebug
    18. Index
    19. About the Author
    20. Colophon
    21. SPECIAL OFFER: Upgrade this ebook with O’Reilly

Product information

  • Title: Data-Driven Services with Silverlight 2
  • Author(s): John Papa
  • Release date: December 2008
  • Publisher(s): O'Reilly Media, Inc.
  • ISBN: 9780596554422