+ All Categories
Home > Documents > Iasi code camp 20 april 2013 gabriel enea - designing o-data services with asp.net web api

Iasi code camp 20 april 2013 gabriel enea - designing o-data services with asp.net web api

Date post: 05-Dec-2014
Category:
Upload: codecampiasi
View: 550 times
Download: 0 times
Share this document with a friend
Description:
 
24
Designing OData Services with ASP.NET Web API Gabriel ENEA Technical Lead @ @dotnet18 / gabrielenea.blogspot.com 20 April 2013
Transcript
Page 1: 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

Page 2: Iasi code camp 20 april 2013   gabriel enea - designing o-data services with asp.net web api

Our world is

awash in data

Page 3: Iasi code camp 20 april 2013   gabriel enea - designing o-data services with asp.net web api

BUSINESS AND FINANCE

Page 4: Iasi code camp 20 april 2013   gabriel enea - designing o-data services with asp.net web api

HEALTH AND WELLNESS

Page 5: Iasi code camp 20 april 2013   gabriel enea - designing o-data services with asp.net web api

AUTOMOTIVE, INDUSTRIAL, &

AEROSPACE

Page 6: Iasi code camp 20 april 2013   gabriel enea - designing o-data services with asp.net web api

GOVERNMENT

Page 7: Iasi code camp 20 april 2013   gabriel enea - designing o-data services with asp.net web api

SPORTS AND GAMES

Page 8: Iasi code camp 20 april 2013   gabriel enea - designing o-data services with asp.net web api

WORLDWIDE HISTORICAL

WEATHER DATA

Page 9: Iasi code camp 20 april 2013   gabriel enea - designing o-data services with asp.net web api
Page 10: Iasi code camp 20 april 2013   gabriel enea - designing o-data services with asp.net web api

The Data has value only if it can be used

Page 11: Iasi code camp 20 april 2013   gabriel enea - designing o-data services with asp.net web api

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

Page 12: Iasi code camp 20 april 2013   gabriel enea - designing o-data services with asp.net web api

Demo 1

•Using OData with Excel

Page 13: Iasi code camp 20 april 2013   gabriel enea - designing o-data services with asp.net web api

How OData works?

OData

Client Library

OData Service

OData

Data Model

OData Protocol

Client

Data Source

HTTP, REST,

JSON/Atom

Page 14: Iasi code camp 20 april 2013   gabriel enea - designing o-data services with asp.net web api

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

Page 15: Iasi code camp 20 april 2013   gabriel enea - designing o-data services with asp.net web api

OData Formats

•Atom Pub (XML)

• JSON “light” (introduced in OData v3)

• JSON “verbose” (OData v2)

Page 16: Iasi code camp 20 april 2013   gabriel enea - designing o-data services with asp.net web api

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.

Page 17: Iasi code camp 20 april 2013   gabriel enea - designing o-data services with asp.net web api

OData features in ASP.NET Web API

•Queries

•CRUD operations

• Entity Relations

•Actions

•Handling errors

• OData compliant errors

• Handling Unmapped Requests

Page 18: Iasi code camp 20 april 2013   gabriel enea - designing o-data services with asp.net web api

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)"}

Page 19: Iasi code camp 20 april 2013   gabriel enea - designing o-data services with asp.net web api

Demo 2+

• Formats

•Queries

•CRUD operations

• Entity Relations

•Actions

•Handling errors

Page 20: Iasi code camp 20 april 2013   gabriel enea - designing o-data services with asp.net web api

OData Security Guidance

• EDM Security

• [IgnoreDataMember] attribute

•Query Security

Page 21: Iasi code camp 20 april 2013   gabriel enea - designing o-data services with asp.net web api

OData features coming later to

ASP.NET Web API

• $expand

• $select

•Batch updates

•Media streams (picture, media files)

Page 22: Iasi code camp 20 april 2013   gabriel enea - designing o-data services with asp.net web api

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

Page 23: Iasi code camp 20 april 2013   gabriel enea - designing o-data services with asp.net web api

Resources

www.odata.org

www.asp.net/web-api

Page 24: Iasi code camp 20 april 2013   gabriel enea - designing o-data services with 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


Recommended