Deep Dive into ADO.NET Data Services
description
Transcript of Deep Dive into ADO.NET Data Services
Deep Dive into ADO.NET Data Services
AgendaService ExtensibilityCustom Object ModelOperation BatchingASP.NET AJAX client
Service ExtensibilityService OperationsQuery InterceptorsChange Interceptors
Data Model
Products Categories
Data Service
Possible Endpoints/Products/Categories
Service Operations
Data Model
Products Categories
Data Service/GetBrakes
HTTP GET/POSTGetBrakes()
Query Interceptor
Data Model
Products Categories
Data Service/Products
QueryInterceptor
HTTP GET
Change Interceptors
Data Model
Products Categories
Data Service/Products
ChangeInterceptor
HTTP POST HTTP PUT/DELETE
/Products(1)
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
DemoService Extensibility
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
DemoCustom Object Model
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
Operation Batching
DataServiceContext
1) Add Entity2) Update Entity3) Add Entity #24) Delete Entity5) Delete Entity #2
DataServicePOST /$batch
Operations:1 server hit
With batching
Operation Batching
DataServiceContext
1) Get Entity #12) Get Entity #23) Get Entity #3
DataService
Operations:3 server hits
Without batching
GETGETGET
Operation Batching
DataServiceContext
1) Get Entity #12) Get Entity #23) Get Entity #3
DataService
Operations:1 server hit
With batching
GET /$batch
DemoOperation Batching
ASP.NET AJAX Client
DataServiceHTTP
DataModel
Sys.Data.DataService
JSON
ServerClient
ASP.NET AJAX ClientSys.Data.ActionSequenceSys.Data.DataServiceSys.Data.QueryBuilder
DemoASP.NET AJAX Client
SummaryService ExtensibilityQuery BatchingCustom Object ModelASP.NET AJAX client