Download - 1 ADO.NET Data Services Mike Taulty Developer & Platform Group Microsoft Ltd [email protected]
![Page 1: 1 ADO.NET Data Services Mike Taulty Developer & Platform Group Microsoft Ltd Mike.Taulty@microsoft.com](https://reader036.vdocuments.net/reader036/viewer/2022062409/5697bfab1a28abf838c9b157/html5/thumbnails/1.jpg)
1
ADO.NET Data Services
Mike TaultyDeveloper & Platform GroupMicrosoft [email protected] http://www.mtaulty.com
![Page 2: 1 ADO.NET Data Services Mike Taulty Developer & Platform Group Microsoft Ltd Mike.Taulty@microsoft.com](https://reader036.vdocuments.net/reader036/viewer/2022062409/5697bfab1a28abf838c9b157/html5/thumbnails/2.jpg)
Agenda
Overview
Exposing data sources
Building clients
Server-side interception
![Page 3: 1 ADO.NET Data Services Mike Taulty Developer & Platform Group Microsoft Ltd Mike.Taulty@microsoft.com](https://reader036.vdocuments.net/reader036/viewer/2022062409/5697bfab1a28abf838c9b157/html5/thumbnails/3.jpg)
Data Services – Overview
Provides new functionalityCRUD access to data over RESTful web servicesBuilt-in URI-based query syntaxClient-side libraries for .NET, Silverlight and AJAX
Builds on top of Windows Communication Foundation V3.5Status
In VS 2008 Service Pack 1, .NET Framework 3.5 Sp1Shipped in 2008
![Page 4: 1 ADO.NET Data Services Mike Taulty Developer & Platform Group Microsoft Ltd Mike.Taulty@microsoft.com](https://reader036.vdocuments.net/reader036/viewer/2022062409/5697bfab1a28abf838c9b157/html5/thumbnails/4.jpg)
RESTful Web Services?
Resources
Res 1
Res 2
Res 3
Res 4
HTTP RequestURL
VERBPayload
HTTP Response
Status
GETPOSTPUT
DELETEXML JSON
Payload
XML JSON
![Page 5: 1 ADO.NET Data Services Mike Taulty Developer & Platform Group Microsoft Ltd Mike.Taulty@microsoft.com](https://reader036.vdocuments.net/reader036/viewer/2022062409/5697bfab1a28abf838c9b157/html5/thumbnails/5.jpg)
RESTful?
REpresentational State TransferServer-side resources identified by a URIAccess is over HTTP, verb tied to action
GET to read the value of a resourcePOST to create a new resourcePUT to update an existing resourceDELETE to delete a resource
Returned data is “plain” – XML or JSONIs this “the death of SOAP”?
![Page 6: 1 ADO.NET Data Services Mike Taulty Developer & Platform Group Microsoft Ltd Mike.Taulty@microsoft.com](https://reader036.vdocuments.net/reader036/viewer/2022062409/5697bfab1a28abf838c9b157/html5/thumbnails/6.jpg)
Data? What Kind of Data?
Provide a type with public properties which are IQueryable<T>
Some rules about how T has to be formedRemember the extension method AsQueryable()
Only get write access if your type implements IUpdatableWorks well with generated code from;
ADO.NET Entity Framework (ObjectContext)LINQ to SQL (DataContext*)
![Page 7: 1 ADO.NET Data Services Mike Taulty Developer & Platform Group Microsoft Ltd Mike.Taulty@microsoft.com](https://reader036.vdocuments.net/reader036/viewer/2022062409/5697bfab1a28abf838c9b157/html5/thumbnails/7.jpg)
7
Exposing Data
demo
![Page 8: 1 ADO.NET Data Services Mike Taulty Developer & Platform Group Microsoft Ltd Mike.Taulty@microsoft.com](https://reader036.vdocuments.net/reader036/viewer/2022062409/5697bfab1a28abf838c9b157/html5/thumbnails/8.jpg)
ADO.NET Entity Framework ?
SQL Provider Oracle Provider ...
Entity Provider
Conceptual Model
Store Model
Map
ADO.NET API ORM API
![Page 9: 1 ADO.NET Data Services Mike Taulty Developer & Platform Group Microsoft Ltd Mike.Taulty@microsoft.com](https://reader036.vdocuments.net/reader036/viewer/2022062409/5697bfab1a28abf838c9b157/html5/thumbnails/9.jpg)
9
Using Entity Framework Data
demo
![Page 10: 1 ADO.NET Data Services Mike Taulty Developer & Platform Group Microsoft Ltd Mike.Taulty@microsoft.com](https://reader036.vdocuments.net/reader036/viewer/2022062409/5697bfab1a28abf838c9b157/html5/thumbnails/10.jpg)
Querying with Data Services
URI based query mechanismhttp://myservice.svc/MyEntitySet
Supports the notion of navigating by primary key
MyEntitySet ( Col1=Value1, Col2=Value2, ... )Supports various operators
$orderby, $top, $skip, $expand, $filter, $value
![Page 11: 1 ADO.NET Data Services Mike Taulty Developer & Platform Group Microsoft Ltd Mike.Taulty@microsoft.com](https://reader036.vdocuments.net/reader036/viewer/2022062409/5697bfab1a28abf838c9b157/html5/thumbnails/11.jpg)
Operators for $filterLogic
eqnegtgteqltlteqandornot
Arithmeticaddsubmuldivmodroundfloorceiling
Stringcontainsendswithstartswithlengthindexofinsertremove x 2replacesubstringtolowertouppertrimconcat
Date/Timesecondhourminutedaymonthyear
Typeisofcast
![Page 12: 1 ADO.NET Data Services Mike Taulty Developer & Platform Group Microsoft Ltd Mike.Taulty@microsoft.com](https://reader036.vdocuments.net/reader036/viewer/2022062409/5697bfab1a28abf838c9b157/html5/thumbnails/12.jpg)
12
Querying with the URI
demo
![Page 13: 1 ADO.NET Data Services Mike Taulty Developer & Platform Group Microsoft Ltd Mike.Taulty@microsoft.com](https://reader036.vdocuments.net/reader036/viewer/2022062409/5697bfab1a28abf838c9b157/html5/thumbnails/13.jpg)
Building Clients
Services offer metadataMyService.svc/$metadata
.NET clients made easier through a proxy generation tool
Visual Studio or datasvcutil.exeUseful for both regular .NET clients & Silverlight
AJAX clients made easier through a script library
“ASP.NET AJAX 4.0 Preview 4”Available as a download on Codeplex
![Page 14: 1 ADO.NET Data Services Mike Taulty Developer & Platform Group Microsoft Ltd Mike.Taulty@microsoft.com](https://reader036.vdocuments.net/reader036/viewer/2022062409/5697bfab1a28abf838c9b157/html5/thumbnails/14.jpg)
14
Building Clients
demo
![Page 15: 1 ADO.NET Data Services Mike Taulty Developer & Platform Group Microsoft Ltd Mike.Taulty@microsoft.com](https://reader036.vdocuments.net/reader036/viewer/2022062409/5697bfab1a28abf838c9b157/html5/thumbnails/15.jpg)
Interception & Operations
Possible to hook code into the frameworkFor queries we can write
Query interceptorsFor modifications we can write
Change interceptorsCan also expose custom functionality
Service OperationsUseful for providing “canned” functionality, can be parameterised
![Page 16: 1 ADO.NET Data Services Mike Taulty Developer & Platform Group Microsoft Ltd Mike.Taulty@microsoft.com](https://reader036.vdocuments.net/reader036/viewer/2022062409/5697bfab1a28abf838c9b157/html5/thumbnails/16.jpg)
16
Interception, Operations
demo
![Page 17: 1 ADO.NET Data Services Mike Taulty Developer & Platform Group Microsoft Ltd Mike.Taulty@microsoft.com](https://reader036.vdocuments.net/reader036/viewer/2022062409/5697bfab1a28abf838c9b157/html5/thumbnails/17.jpg)
“Coming Soon”
ADO.NET Data Services V1.5Sits on top of .NET Framework V3.5 Sp1Feature and bug release
Data binding, row counts, paging, BLOB support, interface for provider writers
DownloadADO.NET Data Services Offline, Alpha Preview
Local SQL Compact DBAccessed via the same RESTful servicesKept in sync via the Sync FrameworkDownload
![Page 18: 1 ADO.NET Data Services Mike Taulty Developer & Platform Group Microsoft Ltd Mike.Taulty@microsoft.com](https://reader036.vdocuments.net/reader036/viewer/2022062409/5697bfab1a28abf838c9b157/html5/thumbnails/18.jpg)
Resources
Other topics to considerBatching of queries, updatesOptimistic concurrency modeletc
Data Services (“Astoria”) Team Bloghttp://blogs.msdn.com/astoriateam
My website http://www.mtaulty.com ( search Data Services )
![Page 19: 1 ADO.NET Data Services Mike Taulty Developer & Platform Group Microsoft Ltd Mike.Taulty@microsoft.com](https://reader036.vdocuments.net/reader036/viewer/2022062409/5697bfab1a28abf838c9b157/html5/thumbnails/19.jpg)
© 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.