Transcript
Page 1: Deep Dive into ADO.NET Data Services

Deep Dive into ADO.NET Data Services

Page 2: Deep Dive into ADO.NET Data Services

AgendaService ExtensibilityCustom Object ModelOperation BatchingASP.NET AJAX client

Page 3: Deep Dive into ADO.NET Data Services

Service ExtensibilityService OperationsQuery InterceptorsChange Interceptors

Data Model

Products Categories

Data Service

Possible Endpoints/Products/Categories

Page 4: Deep Dive into ADO.NET Data Services

Service Operations

Data Model

Products Categories

Data Service/GetBrakes

HTTP GET/POSTGetBrakes()

Page 5: Deep Dive into ADO.NET Data Services

Query Interceptor

Data Model

Products Categories

Data Service/Products

QueryInterceptor

HTTP GET

Page 6: Deep Dive into ADO.NET Data Services

Change Interceptors

Data Model

Products Categories

Data Service/Products

ChangeInterceptor

HTTP POST HTTP PUT/DELETE

/Products(1)

Page 7: Deep Dive into ADO.NET Data Services

Service Extensibility – Why?Service Operations1. Business logic2. Data shaping3. Custom endpoint

• Query Interceptor1. Data filter2. Row-level security

• Change Interceptor1. Business logic2. Logging3. Data modification

Page 8: Deep Dive into ADO.NET Data Services

DemoService Extensibility

Page 9: Deep Dive into ADO.NET Data Services

Custom Object ModelEDM CLR

EntityContainer Public class with IQueryable<T> properties

EntityType Public class with identity

ComplexType Public class/struct that isn’t top level

EntityKeyPublic property named “ID”, “[EntityName]ID”, or the DataServiceKey attribute

EntitySet Public IQueryable<T> property on the EntityContainer

PropertyPublic property on EntityType that returns a scalar or ComplexType value

NavigationProperty

Public property on EntityType that returns another EntityType or an IList of an EntityType

Page 10: Deep Dive into ADO.NET Data Services

DemoCustom Object Model

Page 11: Deep Dive into ADO.NET Data Services

Operation Batching

DataServiceContext

1) Add Entity #12) Update Entity3) Add Entity #24) Delete Entity #15) Delete Entity #2

DataService

POSTPUT

POSTDELETEDELETE

Operations:5 server hits

Without batching

Page 12: Deep Dive into ADO.NET Data Services

Operation Batching

DataServiceContext

1) Add Entity2) Update Entity3) Add Entity #24) Delete Entity5) Delete Entity #2

DataServicePOST /$batch

Operations:1 server hit

With batching

Page 13: Deep Dive into ADO.NET Data Services

Operation Batching

DataServiceContext

1) Get Entity #12) Get Entity #23) Get Entity #3

DataService

Operations:3 server hits

Without batching

GETGETGET

Page 14: Deep Dive into ADO.NET Data Services

Operation Batching

DataServiceContext

1) Get Entity #12) Get Entity #23) Get Entity #3

DataService

Operations:1 server hit

With batching

GET /$batch

Page 15: Deep Dive into ADO.NET Data Services

DemoOperation Batching

Page 16: Deep Dive into ADO.NET Data Services

ASP.NET AJAX Client

DataServiceHTTP

DataModel

Sys.Data.DataService

JSON

ServerClient

Page 17: Deep Dive into ADO.NET Data Services

ASP.NET AJAX ClientSys.Data.ActionSequenceSys.Data.DataServiceSys.Data.QueryBuilder

Page 18: Deep Dive into ADO.NET Data Services

DemoASP.NET AJAX Client

Page 19: Deep Dive into ADO.NET Data Services

SummaryService ExtensibilityQuery BatchingCustom Object ModelASP.NET AJAX client

Page 20: Deep Dive into ADO.NET Data Services

Top Related