Iasi code camp 20 april 2013 gabriel enea - designing o-data services with asp.net web api
-
Upload
codecampiasi -
Category
Documents
-
view
550 -
download
0
description
Transcript of Iasi code camp 20 april 2013 gabriel enea - designing o-data services with asp.net web api
Designing OData Services
with ASP.NET Web APIGabriel ENEA
Technical Lead @
@dotnet18 / gabrielenea.blogspot.com
20 April 2013
Our world is
awash in data
BUSINESS AND FINANCE
HEALTH AND WELLNESS
AUTOMOTIVE, INDUSTRIAL, &
AEROSPACE
GOVERNMENT
SPORTS AND GAMES
WORLDWIDE HISTORICAL
WEATHER DATA
The Data has value only if it can be used
What is the Open Data Protocol?
Web Browsers
Mobile Phones
BI tools
Custom applications (.NET, Java,
PHP)
Clients
OData
Custom applications (.NET, Java,
PHP)
Cloud Storage (Windows
Azure Tables, SQL Azure)
Content Management (SharePoint)
Windows Azure Data
Marketplace
Data Sources
Demo 1
•Using OData with Excel
How OData works?
OData
Client Library
OData Service
OData
Data Model
OData Protocol
Client
Data Source
HTTP, REST,
JSON/Atom
Entity Container
Entity SetEntity Set
Entity
OData Entity Data Model
PropertyNavigation Property
Entity
PropertyNavigation Property
Entity
PropertyNavigation Property
Entity
Property Property
Entity
Property Property
Association
Association
GET http://www.fabrikam.com/odata/$metadata
OData Formats
•Atom Pub (XML)
• JSON “light” (introduced in OData v3)
• JSON “verbose” (OData v2)
OData Query Options
Option Description
$filter Filters the results, based on a Boolean
condition.
$inlinecount Tells the server to include the total count of
matching entities in the response. (Useful for
server-side paging.)
$orderby Sorts the results.
$skip Skips the first n results.
$top Returns only the first n the results.
OData features in ASP.NET Web API
•Queries
•CRUD operations
• Entity Relations
•Actions
•Handling errors
• OData compliant errors
• Handling Unmapped Requests
OData Entity Relations / Links
• Edit relationships between two entities
• Each link has a URI with the form:
entity/$links/entity
• e.g.:
/Jobs(1)/$links/Company
POST http://localhost/odata/jobs(1)/$links/Company
Content-Type: application/json
Content-Length: 50
{"url":"http://localhost/odata/companies(‘Maxcode)"}
Demo 2+
• Formats
•Queries
•CRUD operations
• Entity Relations
•Actions
•Handling errors
OData Security Guidance
• EDM Security
• [IgnoreDataMember] attribute
•Query Security
OData features coming later to
ASP.NET Web API
• $expand
• $select
•Batch updates
•Media streams (picture, media files)
Consuming OData Services
• Your Browser (e.g. OData Explorer)
• .NET: WCF Data Services
• Java: odata4j (including Java on Android)
• JavaScript: JQuery, JayData, datajs, Breeze
• PHP: OData SDK for PHP
• Fiddler, LinqPad
Resources
www.odata.org
www.asp.net/web-api
Designing OData Services with ASP.NET Web API
Gabriel ENEA
Technical Lead – Maxcode
@dotnet18 / gabrielenea.blogspot.com
20 April 2013
Please fill in your evaluation form