Slide Deck - SQLBits

fortnecessityusefulΛογισμικό & κατασκευή λογ/κού

14 Δεκ 2013 (πριν από 3 χρόνια και 7 μήνες)

73 εμφανίσεις

1

ADO.NET Data Services

Mike Taulty

Developer & Platform Group

Microsoft Ltd

Mike.Taulty@microsoft.com


http://www.mtaulty.com


Agenda

Overview

Exposing data sources

Building clients

Server
-
side interception

Data Services


Overview

Provides new functionality

CRUD access to
data

over
RESTful

web services

Built
-
in
URI
-
based query

syntax

Client
-
side libraries for
.NET
,
Silverlight

and

AJAX

Builds on top of Windows Communication
Foundation V3.5

Status

In
VS 2008 Service Pack 1, .NET Framework 3.5 Sp1

Shipped in 2008

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

RESTful
?

RE
presentational

S
tate
T
ransfer

Server
-
side resources identified by a URI

Access is over HTTP, verb tied to action

GET

to read the value of a resource

POST

to create a new resource

PUT

to update an existing resource

DELETE

to delete a resource

Returned data is “plain”


XML or JSON

Is this “the death of SOAP”?


Data? What Kind of Data?

Provide a type with public properties which are
IQueryable
<T>

Some rules about how
T

has to be formed

Remember the extension method
AsQueryable
()

Only get write access if your type implements
IUpdatable

Works well with generated code from;

ADO.NET Entity Framework (
ObjectContext
)

LINQ to SQL (
DataContext
*)



7

Exposin
g Data

ADO.NET Entity Framework ?

SQL Provider

Oracle Provider

...

Entity Provider

Conceptual Model

Store Model

Map

ADO.NET API

ORM API

9

Using Entity Framework Data

Querying with Data Services

URI based query mechanism

http://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

Operators for $filter

Logic

eq

ne

gt

gteq

lt

lteq

and

or

not

Arithmetic

add

sub

mul

div

mod

round

floor

ceiling

String

contains

endswith

startswith

length

indexof

insert

remove x 2

replace

substring

tolower

toupper

trim

concat

Date/Time

second

hour

minute

day

month

year

Type

isof

cast

12

Querying with the URI

Building Clients

Services offer metadata

MyService.svc/$metadata

.NET clients made easier through a proxy
generation tool

Visual Studio or datasvcutil.exe

Useful 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


14

Building Clients

Interception & Operations

Possible to hook code into the framework

For queries we can write

Query interceptors

For modifications we can write

Change interceptors

Can also expose custom functionality

Service Operations

Useful for providing “canned” functionality, can be
parameterised

16

Interception, Operations

“Coming Soon”

ADO.NET Data Services V1.5

Sits on top of .NET Framework V3.5 Sp1

Feature and bug release

Data binding, row counts, paging, BLOB support, interface
for provider writers

Download

ADO.NET Data Services Offline, Alpha Preview

Local SQL Compact DB

Accessed via the same
RESTful

services

Kept in sync via the Sync Framework

Download

Resources

Other topics to consider

Batching of queries, updates

Optimistic concurrency model

etc

Data Services (“Astoria”) Team Blog

http://blogs.msdn.com/astoriateam


My website


http://www.mtaulty.com

( search Data Services )


©
2008 Microsoft
Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademar
ks
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
dat
e 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 informatio
n p
rovided after the date of this presentation.
MICROSOFT
MAKES NO WARRANTIES, EXPRESS,
IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.