ADO.NET Data Services Mike Taulty Developer & Platform Group Microsoft Ltd [email_address]   http://www.miketaulty.com
Agenda <ul><li>The core bits that we’ll demo </li></ul><ul><ul><li>Overview of ADO.NET Data Services </li></ul></ul><ul><u...
Data Services – Overview <ul><li>Provides new functionality </li></ul><ul><ul><li>CRUD access to  data  over  RESTful  web...
RESTful Web Services? Resources Res 1 Res 2 Res 3 Res 4 HTTP Request URL VERB Payload HTTP Response Status GET POST PUT DE...
RESTful? <ul><li>RE presentational  S tate  T ransfer </li></ul><ul><ul><li>Server-side resources identified by a URI </li...
Data? What Kind of Data? <ul><li>Provide a type with public properties which are  IQueryable<T> </li></ul><ul><ul><li>Some...
Exposing Data
ADO.NET Entity Framework ? SQL Provider Oracle Provider ... Entity Provider Conceptual Model Store Model Map ADO.NET API O...
Using Entity Framework Data
Querying with Data Services <ul><li>URI based query mechanism </li></ul><ul><ul><li>http://myservice.svc/MyEntitySet </li>...
Operators for $filter
Querying with the URI
Building Clients <ul><li>Services offer metadata </li></ul><ul><ul><li>MyService.svc/$metadata </li></ul></ul><ul><li>.NET...
Building Clients
Interception & Operations <ul><li>Possible to hook code into the framework </li></ul><ul><li>For queries we can write </li...
Interception, Operations
Batching of Operations “ INSERT” Customer 1 POST Order 1 POST Order 2 POST Order N POST
Batching of Operations “ INSERT” Customer 1 Order 1 Order 2 Order N POST
Batching of Operations <ul><li>Provides a mechanism to process  a batch </li></ul><ul><ul><li>0 or more Query operations <...
Batching
Managing Concurrency GET GET Customer: ALFKI Country: Spain Customer: ALFKI Country: Spain
Managing Concurrency PUT Customer: ALFKI Country:  UK PUT Customer: ALFKI Country:  Germany
Managing Concurrency <ul><li>Optimistic concurrency </li></ul><ul><li>Attribute used to specify properties </li></ul><ul><...
Concurrency
Resources <ul><li>New Data Developer Site </li></ul><ul><ul><li>http://www.datadeveloper.net   </li></ul></ul><ul><li>Data...
© 2008 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be...
Upcoming SlideShare
Loading in...5
×

ADO.NET Data Services

1,679

Published on

ADO.NET Data Services

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
1,679
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
107
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide
  • 06/07/09 01:41 © 2007 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.
  • ADO.NET Data Services

    1. 1. ADO.NET Data Services Mike Taulty Developer & Platform Group Microsoft Ltd [email_address] http://www.miketaulty.com
    2. 2. Agenda <ul><li>The core bits that we’ll demo </li></ul><ul><ul><li>Overview of ADO.NET Data Services </li></ul></ul><ul><ul><li>Exposing data sources </li></ul></ul><ul><ul><li>Building clients </li></ul></ul><ul><ul><li>Intercepting the server-side dispatch process </li></ul></ul><ul><li>The extra bits that we’ll talk about </li></ul><ul><ul><li>Dealing with batched operations </li></ul></ul><ul><ul><li>Dealing with concurrency </li></ul></ul>
    3. 3. Data Services – Overview <ul><li>Provides new functionality </li></ul><ul><ul><li>CRUD access to data over RESTful web services </li></ul></ul><ul><ul><li>Built-in URI-based query syntax </li></ul></ul><ul><ul><li>Client-side libraries for .NET , AJAX and Silverlight </li></ul></ul><ul><li>Builds on top of WCF V3.5 </li></ul><ul><li>Status </li></ul><ul><ul><li>In VS 2008 Service Pack 1 , Ships Summer 2008 </li></ul></ul><ul><ul><li>Current version is in Sp1 Beta 1 but has been through various previews </li></ul></ul>
    4. 4. RESTful Web Services? Resources Res 1 Res 2 Res 3 Res 4 HTTP Request URL VERB Payload HTTP Response Status GET POST PUT DELETE XML JSON Payload XML JSON
    5. 5. RESTful? <ul><li>RE presentational S tate T ransfer </li></ul><ul><ul><li>Server-side resources identified by a URI </li></ul></ul><ul><ul><li>Access is over HTTP, verb tied to action </li></ul></ul><ul><ul><ul><li>GET to read the value of a resource </li></ul></ul></ul><ul><ul><ul><li>POST to create a new resource </li></ul></ul></ul><ul><ul><ul><li>PUT to update an existing resource </li></ul></ul></ul><ul><ul><ul><li>DELETE to delete a resource </li></ul></ul></ul><ul><ul><li>Returned data is “plain” – XML or JSON </li></ul></ul><ul><li>Is this “the death of SOAP”? </li></ul>
    6. 6. Data? What Kind of Data? <ul><li>Provide a type with public properties which are IQueryable<T> </li></ul><ul><ul><li>Some rules about how T has to be formed </li></ul></ul><ul><ul><li>Remember the extension method AsQueryable() </li></ul></ul><ul><li>Only get write access if your type implements IUpdatable </li></ul><ul><li>Works well with generated code from; </li></ul><ul><ul><li>ADO.NET Entity Framework ( ObjectContext ) </li></ul></ul><ul><ul><li>LINQ to SQL ( DataContext *) </li></ul></ul>
    7. 7. Exposing Data
    8. 8. ADO.NET Entity Framework ? SQL Provider Oracle Provider ... Entity Provider Conceptual Model Store Model Map ADO.NET API ORM API
    9. 9. Using Entity Framework Data
    10. 10. Querying with Data Services <ul><li>URI based query mechanism </li></ul><ul><ul><li>http://myservice.svc/MyEntitySet </li></ul></ul><ul><li>Supports the notion of navigating by primary key </li></ul><ul><ul><li>MyEntitySet ( MyPrimaryKeyCol1, Col2, ... ) </li></ul></ul><ul><li>Supports various operators </li></ul><ul><ul><li>$orderby, $top, $skip, $expand, $filter, $value </li></ul></ul>
    11. 11. Operators for $filter
    12. 12. Querying with the URI
    13. 13. Building Clients <ul><li>Services offer metadata </li></ul><ul><ul><li>MyService.svc/$metadata </li></ul></ul><ul><li>.NET clients made easier through a proxy generation tool </li></ul><ul><ul><li>datasvcutil.exe </li></ul></ul><ul><ul><li>Useful for both regular .NET clients & Silverlight </li></ul></ul><ul><li>AJAX clients made easier through a script library </li></ul><ul><ul><li>“ Data Service AJAX Client Library” </li></ul></ul><ul><ul><li>Available as a download on Codeplex </li></ul></ul>
    14. 14. Building Clients
    15. 15. Interception & Operations <ul><li>Possible to hook code into the framework </li></ul><ul><li>For queries we can write </li></ul><ul><ul><li>Query interceptors </li></ul></ul><ul><li>For modifications we can write </li></ul><ul><ul><li>Change interceptors </li></ul></ul><ul><li>Can also expose custom functionality </li></ul><ul><ul><li>Service Operations </li></ul></ul><ul><ul><li>Useful for providing “canned” functionality, can be parameterised </li></ul></ul>
    16. 16. Interception, Operations
    17. 17. Batching of Operations “ INSERT” Customer 1 POST Order 1 POST Order 2 POST Order N POST
    18. 18. Batching of Operations “ INSERT” Customer 1 Order 1 Order 2 Order N POST
    19. 19. Batching of Operations <ul><li>Provides a mechanism to process a batch </li></ul><ul><ul><li>0 or more Query operations </li></ul></ul><ul><ul><li>0 or more [Create/Update/Delete] operations </li></ul></ul><ul><li>Uses multipart/mixed MIME type sent to a $batch endpoint </li></ul><ul><li>Use </li></ul><ul><ul><li>SaveChanges(SaveChangesOptions.Batch) </li></ul></ul><ul><ul><li>ExecuteBatch() </li></ul></ul>
    20. 20. Batching
    21. 21. Managing Concurrency GET GET Customer: ALFKI Country: Spain Customer: ALFKI Country: Spain
    22. 22. Managing Concurrency PUT Customer: ALFKI Country: UK PUT Customer: ALFKI Country: Germany
    23. 23. Managing Concurrency <ul><li>Optimistic concurrency </li></ul><ul><li>Attribute used to specify properties </li></ul><ul><ul><li>Not necessary for Entity Framework data </li></ul></ul><ul><li>Standard HTTP protocol used </li></ul><ul><ul><li>eTags used to send to client ( in XML if necessary ) </li></ul></ul><ul><ul><li>HTTP If-match headers used to check when PUT/DELETE occurs ( 412 returned for failure ) </li></ul></ul>
    24. 24. Concurrency
    25. 25. Resources <ul><li>New Data Developer Site </li></ul><ul><ul><li>http://www.datadeveloper.net </li></ul></ul><ul><li>Data Services (“Astoria”) Team Blog </li></ul><ul><ul><li>http://blogs.msdn.com/astoriateam </li></ul></ul><ul><li>My website  </li></ul><ul><ul><li>http://www.miketaulty.com ( search Data Services ) </li></ul></ul>
    26. 26. © 2008 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.
    1. A particular slide catching your eye?

      Clipping is a handy way to collect important slides you want to go back to later.

    ×