SlideShare a Scribd company logo
#devsum15
Learning How to Shape and
Configure an OData Feed for High
Performing Web Sites and
Applications
Chris Woodruff
@cwoodruff cwoodruff@live.com
Hi, I’m Woody!
Chris Woodruff
• cwoodruff@live.com
• http://chriswoodruff.com
• http://deepfriedbytes.com
• twitter @cwoodruff
VALIDATION CLIENT SIDEBEST PRACTICES
AGENDA
What are the 2 Sides of OData?
SERVER-SIDE (PRODUCER) CLIENT-SIDE (CONSUMER)
Server Side for OData
UNDERSTAND REST
The Top Reasons You Need to Learn about Data in Your Windows Phone App
Learning How to Shape and Configure an OData Service for High Performing Web and Mobile Applications
WHAT IS REST?
RESOURCES
VERBS
URL
WHAT SHOULD YOU KNOW ABOUT REST?
Resources
REST uses addressable resources to define the
structure of the API. These are the URLs you use to
get to pages on the web
Request Headers
These are additional instructions that are sent with the
request. These might define what type of response is
required or authorization details.
Request Verbs
These describe what you want to do with the resource.
A browser typically issues a GET verb to instruct the
endpoint it wants to get data, however there are many
other verbs available including things like POST, PUT
and DELETE.
Request Body
Data that is sent with the request. For example a
POST (creation of a new item) will required some data
which is typically sent as the request body in the format
of JSON or XML.
Response Body
This is the main body of the response. If the request
was to a web server, this might be a full HTML page, if
it was to an API, this might be a JSON or XML
document.
Response Status codes
These codes are issues with the response and give
the client details on the status of the request.
REST & HTTP VERBS
GET
Requests a representation of the specified
Requests using GET should only retrieve
have no other effect.
POST
Requests that the server accept the entity
enclosed in the request as a new
subordinate of the web resource identified
by the URI.
PUT
Requests that the enclosed entity be stored
under the supplied URI.
DELETE
Deletes the specified resource.
EXAMPLES OF REST AND ODATA
/Products
RESOURCE EXPECTED OUTCOMEVERB RESPONSE CODE
/Products?$filter=Color eq ‘Red'
/Products
/Products(81)
/Products(881)
/Products(81)
/Products(81)
GET
GET
POST
GET
GET
PUT
DELETE
A list of all products in the system
A list of all products in the system
where the color is red
Creation of a new product
Product with an ID of 81
Some error message
Update of the product with ID of 81
Deletion of the product with ID of
81
200/OK
200/OK
201/Created
200/OK
404/Not Found
204/No Content
204/No Content
BEST PRACTICES
Get to know the OData Protocol!!!
Examples (http://chinookdata.azurewebsites.net)
GET serviceRoot/Artists?$filter=Name eq 'Foo Fighters'
GET serviceRoot/Artists?$filter=contains(Name, 'Foo')
GET serviceRoot/Artists(1)?$expand=Albums
GET serviceRoot/Artists(58)/Albums?$orderby=Title desc
GET serviceRoot/Artists?$skip=20&$top=10
GET serviceRoot/Artists?$search=AC ***
GET serviceRoot/Customer?$filter=Email/any(s:endswith(s, 'contoso.com')) ***
GET serviceRoot/$metadata
Query Projection
Examples (http://chinookdata.azurewebsites.net)
PROPERTIES OF THE CUSTOMER ENTITY
• CustomerId
• FirstName
• LastName
• Company
• Address
• City
• State
QUERY PROJECTIONS FOR PERFORMANCE
GET serviceRoot/Customers?$select=
FirstName, LastName, Company
GET serviceRoot/Customers?$select=
LastName, Address, City, State, Country,
PostalCode
GET serviceRoot/Customers?$select=
FirstName, LastName, Phone, Email
• Country
• PostalCode
• Phone
• Fax
• Email
• SupportRepId
Server Side Paging
Examples
[EnableQuery(PageSize=20)]
Configuration Settings
Examples
invoice.Ignore(t => t.InvoiceDate);
Data Caching with Web API OData v4
Example
Add the CacheCow Server NuGet package to your server project.
Example
Add the following to your WebApiConfig.cs file:
var cacheCowCacheHandler = new CachingHandler(config);
config.MessageHandlers.Add(cacheCowCacheHandler);
When you get a resource you will get an Etag
ETag: W/”002a41972c3d43f0bb14d033907b3f41″
When you make a second request to the same resource, you should send this ETag. The
server uses this identifier to check if the resource you requested has changed
(remember, the server is the authoritative source). If the resource has indeed changed,
it sends you the latest copy. Otherwise, it sends a 304 Not Modified.
VALIDATION AND FILTERING
QUERYABLE ODATAATTRIBUTES
AllowedFunctions
Consider disabling the any() and all() functions, as these can be
0
5
IgnoreDataMember (not with
Queryable)
Represents an Attribute that can be placed on a property to specify
that the property cannot be navigated in OData query.
0
6
PageSize
Enable server-driven paging, to avoid returning a large data set in
one query. For more information
0
1
AllowedQueryOptions
Do you need $filter and $orderby? Some applications might allow
client paging, using $top and $skip, but disable the other query
options.
0
2
AllowedOrderByProperties
Consider restricting $orderby to properties in a clustered index.
Sorting large data without a clustered index is slow.
0
3
AllowedLogicalOperators
Consider any logical operators that you do not want to allow
0
4
Examples
[EnableQuery(AllowedQueryOptions = AllowedQueryOptions.Filter)]
[EnableQuery(AllowedLogicalOperators = AllowedLogicalOperators.Equal)]
[EnableQuery(AllowedFunctions = AllowedFunctions.AllStringFunctions)]
[EnableQuery(AllowedOrderByProperties = "ID")]
ODATAATTRIBUTES (CONT)
NotExpandable
Represents an Attribute that can be placed on a property to specify
be used in the $expand OData query option.
0
5
NotNavigable
Represents an Attribute that can be placed on a property to specify
that the property cannot be navigated in OData query.
0
6
NotSortable
Represents an attribute that can be placed on a property to specify
that the property cannot be used in the $orderby OData query
option.
0
7
NonFilterable
Represents an Attribute that can be placed on a property to specify
that the property cannot be used in the $filter OData query option.
0
1
UnSortable
Represents an Attribute that can be placed on a property to specify
that the property cannot be used in the $orderby OData query
option.
0
2
NotExpandable
Represents an Attribute that can be placed on a property to specify
that the property cannot be used in the $expand OData query
option.
0
3
NotCountable
Represents an Attribute that can be placed on a property to specify
that the $count cannot be applied on the property.
0
4
[NonFilterable]
[Unsortable]
public string Name { get; set; }
QUERY SECURITY
Consider disabling the any() and all() functions,
as these can be slow.
0
6
If any string properties contain large strings—
for example, a product description or a blog
entry—consider disabling the string functions.
0
7
Consider disallowing filtering on navigation
properties. Filtering on navigation properties
can result in a join, which might be slow,
depending on your database schema.
0
8
Test your service with various queries and
profile the DB.
0
1
Enable server-driven paging, to avoid returning
a large data set in one query.
0
2
Do you need $filter and $orderby? Some
applications might allow client paging, using
$top and $skip, but disable the other query
options.
0
3
Consider restricting $orderby to properties in a
clustered index. Sorting large data without a
clustered index is slow.
0
4
Consider restricting $filter queries by writing a
validator that is customized for your database.
0
9
Maximum node count: The MaxNodeCount
property on [Queryable] sets the maximum
number nodes allowed in the $filter syntax tree.
The default value is 100, but you may want to
set a lower value, because a large number of
nodes can be slow to compile.
0
5
VALIDATION PATHS
Filter Query
Represents a validator used to validate a
FilterQueryOption based on the
ODataValidationSettings.
Order By Query
Represents a validator used to validate an
OrderByQueryOption based on the
ODataValidationSettings.
OData Query
Represents a validator used to validate OData queries
based on the ODataValidationSettings.
Select Expand Query
Represents a validator used to validate a
SelectExpandQueryOption based on the
ODataValidationSettings.
Skip Query
Represents a validator used to validate a
SkipQueryOption based on the
ODataValidationSettings.
Top Query
Represents a validator used to validate a
TopQueryOption based on the
ODataValidationSettings.
QUERY SECURITY
// Validator to prevent filtering on navigation properties.
public class MyFilterQueryValidator : FilterQueryValidator
{
public override void ValidateNavigationPropertyNode(
Microsoft.Data.OData.Query.SemanticAst.QueryNode sourceNode,
Microsoft.Data.Edm.IEdmNavigationProperty navigationProperty,
ODataValidationSettings settings)
{
throw new ODataException("No navigation properties");
}
}
// Validator to restrict which properties can be used in $filter expressions.
public class MyFilterQueryValidator : FilterQueryValidator
{
static readonly string[] allowedProperties = { "ReleaseYear", "Title" };
public override void ValidateSingleValuePropertyAccessNode(
SingleValuePropertyAccessNode propertyAccessNode,
ODataValidationSettings settings)
{
string propertyName = null;
if (propertyAccessNode != null)
{
propertyName = propertyAccessNode.Property.Name;
}
if (propertyName != null && !allowedProperties.Contains(propertyName))
{
throw new ODataException(
String.Format("Filter on {0} not allowed", propertyName));
}
base.ValidateSingleValuePropertyAccessNode(propertyAccessNode,
settings);
}
}
Demo
www.chriswoodruff.com Page Number 31
Client Side for OData
DEBUGGING/TESTING
XODATA
Web-based OData Visualizer
FIDDLER
Free web debugging tool which
logs all HTTP(S) traffic between
your computer and the
Internet.
LINQPAD (v3)
Interactively query SQL
databases (among other data
sources such as OData or WCF
Data Services) using LINQ, as
well as interactively writing C#
code without the need for an
IDE.
ODATA
VALIDATOR
Enable OData service authors
to validate their
implementation against the
OData specification to ensure
the service interoperates well
with any OData client.
TESTING/DEBUGGING ODATA
www.websitename.com
CONSUMING ODATA
Demo
Show How to Consume an OData Feed in an Universal App
GITHUB
http://github.com/cwoodruff
Project:
ChinookWebAPIOData
ChinookOData
Where can you find the source for this talk?
ODATA WORKSHOP
01
02
03
04
TESTING/DEBUGGING ODATA
DEVELPING CLIENT SIDE SOLUTIONS
• Web Apps using Javascript to consume Odata
• iOS Swift development for native iPhone and iPad
apps
• Windows 8.1 and Windows Phone apps C# and WinJS
• Android development using Java
• Using Xamarin for consuming OData
LEARNING THE PROTOCOL
• The Metadata and Service Model of OData
• URI Conventions of OData
• Format Conventions of OData
• OData HTTP Conventions and Operations
DEVELPING SERVER SIDE SOLUTIONS
• ASP.NET Web API
• Advanced Performance Tips and Best Practices
Go to http://ChrisWoodruff.com for more details and
pricing
THANK YOU
Find me around the conference and would enjoy chatting
Email: cwoodruff@live.com
Twitter: @cwoodruff
Ad

More Related Content

What's hot (19)

Odata
OdataOdata
Odata
Monalisa Patel
 
JAX-RS 2.0 and OData
JAX-RS 2.0 and ODataJAX-RS 2.0 and OData
JAX-RS 2.0 and OData
Anil Allewar
 
Introduction to OData
Introduction to ODataIntroduction to OData
Introduction to OData
Mindfire Solutions
 
OData Introduction and Impact on API Design (Webcast)
OData Introduction and Impact on API Design (Webcast)OData Introduction and Impact on API Design (Webcast)
OData Introduction and Impact on API Design (Webcast)
Apigee | Google Cloud
 
Gaining the Knowledge of the Open Data Protocol (OData)
Gaining the Knowledge of the Open Data Protocol (OData)Gaining the Knowledge of the Open Data Protocol (OData)
Gaining the Knowledge of the Open Data Protocol (OData)
Woodruff Solutions LLC
 
Learning To Run - XPages for Lotus Notes Client Developers
Learning To Run - XPages for Lotus Notes Client DevelopersLearning To Run - XPages for Lotus Notes Client Developers
Learning To Run - XPages for Lotus Notes Client Developers
Kathy Brown
 
OData: A Standard API for Data Access
OData: A Standard API for Data AccessOData: A Standard API for Data Access
OData: A Standard API for Data Access
Pat Patterson
 
OData Services
OData ServicesOData Services
OData Services
Jovan Popovic
 
Doing REST Right
Doing REST RightDoing REST Right
Doing REST Right
Kerry Buckley
 
REST API Design & Development
REST API Design & DevelopmentREST API Design & Development
REST API Design & Development
Ashok Pundit
 
Introduction To REST
Introduction To RESTIntroduction To REST
Introduction To REST
rainynovember12
 
Practical OData
Practical ODataPractical OData
Practical OData
Vagif Abilov
 
RESTful API Design Fundamentals
RESTful API Design FundamentalsRESTful API Design Fundamentals
RESTful API Design Fundamentals
Hüseyin BABAL
 
OData for iOS developers
OData for iOS developersOData for iOS developers
OData for iOS developers
Glen Gordon
 
Open Data Protocol (OData)
Open Data Protocol (OData)Open Data Protocol (OData)
Open Data Protocol (OData)
Pistoia Alliance
 
Http Status Code Errors in SEO
Http Status Code Errors in SEOHttp Status Code Errors in SEO
Http Status Code Errors in SEO
Adela Roger
 
Design Beautiful REST + JSON APIs
Design Beautiful REST + JSON APIsDesign Beautiful REST + JSON APIs
Design Beautiful REST + JSON APIs
Stormpath
 
Salesforce Admin's guide : the data loader from the command line
Salesforce Admin's guide : the data loader from the command lineSalesforce Admin's guide : the data loader from the command line
Salesforce Admin's guide : the data loader from the command line
Cyrille Coeurjoly
 
The never-ending REST API design debate -- Devoxx France 2016
The never-ending REST API design debate -- Devoxx France 2016The never-ending REST API design debate -- Devoxx France 2016
The never-ending REST API design debate -- Devoxx France 2016
Restlet
 
JAX-RS 2.0 and OData
JAX-RS 2.0 and ODataJAX-RS 2.0 and OData
JAX-RS 2.0 and OData
Anil Allewar
 
OData Introduction and Impact on API Design (Webcast)
OData Introduction and Impact on API Design (Webcast)OData Introduction and Impact on API Design (Webcast)
OData Introduction and Impact on API Design (Webcast)
Apigee | Google Cloud
 
Gaining the Knowledge of the Open Data Protocol (OData)
Gaining the Knowledge of the Open Data Protocol (OData)Gaining the Knowledge of the Open Data Protocol (OData)
Gaining the Knowledge of the Open Data Protocol (OData)
Woodruff Solutions LLC
 
Learning To Run - XPages for Lotus Notes Client Developers
Learning To Run - XPages for Lotus Notes Client DevelopersLearning To Run - XPages for Lotus Notes Client Developers
Learning To Run - XPages for Lotus Notes Client Developers
Kathy Brown
 
OData: A Standard API for Data Access
OData: A Standard API for Data AccessOData: A Standard API for Data Access
OData: A Standard API for Data Access
Pat Patterson
 
REST API Design & Development
REST API Design & DevelopmentREST API Design & Development
REST API Design & Development
Ashok Pundit
 
RESTful API Design Fundamentals
RESTful API Design FundamentalsRESTful API Design Fundamentals
RESTful API Design Fundamentals
Hüseyin BABAL
 
OData for iOS developers
OData for iOS developersOData for iOS developers
OData for iOS developers
Glen Gordon
 
Open Data Protocol (OData)
Open Data Protocol (OData)Open Data Protocol (OData)
Open Data Protocol (OData)
Pistoia Alliance
 
Http Status Code Errors in SEO
Http Status Code Errors in SEOHttp Status Code Errors in SEO
Http Status Code Errors in SEO
Adela Roger
 
Design Beautiful REST + JSON APIs
Design Beautiful REST + JSON APIsDesign Beautiful REST + JSON APIs
Design Beautiful REST + JSON APIs
Stormpath
 
Salesforce Admin's guide : the data loader from the command line
Salesforce Admin's guide : the data loader from the command lineSalesforce Admin's guide : the data loader from the command line
Salesforce Admin's guide : the data loader from the command line
Cyrille Coeurjoly
 
The never-ending REST API design debate -- Devoxx France 2016
The never-ending REST API design debate -- Devoxx France 2016The never-ending REST API design debate -- Devoxx France 2016
The never-ending REST API design debate -- Devoxx France 2016
Restlet
 

Similar to Learning How to Shape and Configure an OData Service for High Performing Web and Mobile Applications (20)

Wcf data services
Wcf data servicesWcf data services
Wcf data services
Eyal Vardi
 
Gaining the Knowledge of the Open Data Protocol (OData)
Gaining the Knowledge of the Open Data Protocol (OData)Gaining the Knowledge of the Open Data Protocol (OData)
Gaining the Knowledge of the Open Data Protocol (OData)
Woodruff Solutions LLC
 
Learning How to Shape and Configure an OData Feed for High Performing Web Sit...
Learning How to Shape and Configure an OData Feed for High Performing Web Sit...Learning How to Shape and Configure an OData Feed for High Performing Web Sit...
Learning How to Shape and Configure an OData Feed for High Performing Web Sit...
Woodruff Solutions LLC
 
RESTfulDay9
RESTfulDay9RESTfulDay9
RESTfulDay9
Akhil Mittal
 
JAX-RS. Developing RESTful APIs with Java
JAX-RS. Developing RESTful APIs with JavaJAX-RS. Developing RESTful APIs with Java
JAX-RS. Developing RESTful APIs with Java
Jerry Kurian
 
Android App Development 06 : Network & Web Services
Android App Development 06 : Network & Web ServicesAndroid App Development 06 : Network & Web Services
Android App Development 06 : Network & Web Services
Anuchit Chalothorn
 
ReST
ReSTReST
ReST
Nader Albert
 
SAP ODATA Overview & Guidelines
SAP ODATA Overview & GuidelinesSAP ODATA Overview & Guidelines
SAP ODATA Overview & Guidelines
Ashish Saxena
 
Webservices in SalesForce (part 1)
Webservices in SalesForce (part 1)Webservices in SalesForce (part 1)
Webservices in SalesForce (part 1)
Mindfire Solutions
 
SFDC Inbound Integrations
SFDC Inbound IntegrationsSFDC Inbound Integrations
SFDC Inbound Integrations
Sujit Kumar
 
Rest with Java EE 6 , Security , Backbone.js
Rest with Java EE 6 , Security , Backbone.jsRest with Java EE 6 , Security , Backbone.js
Rest with Java EE 6 , Security , Backbone.js
Carol McDonald
 
Rest
RestRest
Rest
Carol McDonald
 
MuleSoft London Community February 2020 - MuleSoft and OData
MuleSoft London Community February 2020 - MuleSoft and ODataMuleSoft London Community February 2020 - MuleSoft and OData
MuleSoft London Community February 2020 - MuleSoft and OData
Pace Integration
 
Building RESTfull Data Services with WebAPI
Building RESTfull Data Services with WebAPIBuilding RESTfull Data Services with WebAPI
Building RESTfull Data Services with WebAPI
Gert Drapers
 
Validate your entities with symfony validator and entity validation api
Validate your entities with symfony validator and entity validation apiValidate your entities with symfony validator and entity validation api
Validate your entities with symfony validator and entity validation api
Raffaele Chiocca
 
Troubleshooting.pptx
Troubleshooting.pptxTroubleshooting.pptx
Troubleshooting.pptx
sebastian ordoñez rubiano
 
MuleSoft Surat Virtual Meetup#21 - MuleSoft API and RAML Design Best Practice...
MuleSoft Surat Virtual Meetup#21 - MuleSoft API and RAML Design Best Practice...MuleSoft Surat Virtual Meetup#21 - MuleSoft API and RAML Design Best Practice...
MuleSoft Surat Virtual Meetup#21 - MuleSoft API and RAML Design Best Practice...
Jitendra Bafna
 
Kantara OTTO slides
Kantara OTTO slidesKantara OTTO slides
Kantara OTTO slides
Mike Schwartz
 
distributing over the web
distributing over the webdistributing over the web
distributing over the web
Nicola Baldi
 
UserCentric Identity based Service Invocation
UserCentric Identity based Service InvocationUserCentric Identity based Service Invocation
UserCentric Identity based Service Invocation
guestd5dde6
 
Wcf data services
Wcf data servicesWcf data services
Wcf data services
Eyal Vardi
 
Gaining the Knowledge of the Open Data Protocol (OData)
Gaining the Knowledge of the Open Data Protocol (OData)Gaining the Knowledge of the Open Data Protocol (OData)
Gaining the Knowledge of the Open Data Protocol (OData)
Woodruff Solutions LLC
 
Learning How to Shape and Configure an OData Feed for High Performing Web Sit...
Learning How to Shape and Configure an OData Feed for High Performing Web Sit...Learning How to Shape and Configure an OData Feed for High Performing Web Sit...
Learning How to Shape and Configure an OData Feed for High Performing Web Sit...
Woodruff Solutions LLC
 
JAX-RS. Developing RESTful APIs with Java
JAX-RS. Developing RESTful APIs with JavaJAX-RS. Developing RESTful APIs with Java
JAX-RS. Developing RESTful APIs with Java
Jerry Kurian
 
Android App Development 06 : Network & Web Services
Android App Development 06 : Network & Web ServicesAndroid App Development 06 : Network & Web Services
Android App Development 06 : Network & Web Services
Anuchit Chalothorn
 
SAP ODATA Overview & Guidelines
SAP ODATA Overview & GuidelinesSAP ODATA Overview & Guidelines
SAP ODATA Overview & Guidelines
Ashish Saxena
 
Webservices in SalesForce (part 1)
Webservices in SalesForce (part 1)Webservices in SalesForce (part 1)
Webservices in SalesForce (part 1)
Mindfire Solutions
 
SFDC Inbound Integrations
SFDC Inbound IntegrationsSFDC Inbound Integrations
SFDC Inbound Integrations
Sujit Kumar
 
Rest with Java EE 6 , Security , Backbone.js
Rest with Java EE 6 , Security , Backbone.jsRest with Java EE 6 , Security , Backbone.js
Rest with Java EE 6 , Security , Backbone.js
Carol McDonald
 
MuleSoft London Community February 2020 - MuleSoft and OData
MuleSoft London Community February 2020 - MuleSoft and ODataMuleSoft London Community February 2020 - MuleSoft and OData
MuleSoft London Community February 2020 - MuleSoft and OData
Pace Integration
 
Building RESTfull Data Services with WebAPI
Building RESTfull Data Services with WebAPIBuilding RESTfull Data Services with WebAPI
Building RESTfull Data Services with WebAPI
Gert Drapers
 
Validate your entities with symfony validator and entity validation api
Validate your entities with symfony validator and entity validation apiValidate your entities with symfony validator and entity validation api
Validate your entities with symfony validator and entity validation api
Raffaele Chiocca
 
MuleSoft Surat Virtual Meetup#21 - MuleSoft API and RAML Design Best Practice...
MuleSoft Surat Virtual Meetup#21 - MuleSoft API and RAML Design Best Practice...MuleSoft Surat Virtual Meetup#21 - MuleSoft API and RAML Design Best Practice...
MuleSoft Surat Virtual Meetup#21 - MuleSoft API and RAML Design Best Practice...
Jitendra Bafna
 
distributing over the web
distributing over the webdistributing over the web
distributing over the web
Nicola Baldi
 
UserCentric Identity based Service Invocation
UserCentric Identity based Service InvocationUserCentric Identity based Service Invocation
UserCentric Identity based Service Invocation
guestd5dde6
 
Ad

More from Woodruff Solutions LLC (13)

Developing Mobile Solutions with Azure Mobile Services in Windows 8.1 and Win...
Developing Mobile Solutions with Azure Mobile Services in Windows 8.1 and Win...Developing Mobile Solutions with Azure Mobile Services in Windows 8.1 and Win...
Developing Mobile Solutions with Azure Mobile Services in Windows 8.1 and Win...
Woodruff Solutions LLC
 
Connecting to Data from Windows Phone 8
Connecting to Data from Windows Phone 8Connecting to Data from Windows Phone 8
Connecting to Data from Windows Phone 8
Woodruff Solutions LLC
 
Pushing Data to and from the Cloud with SQL Azure Data Sync -- TechEd NA 2013
Pushing Data to and from the Cloud with SQL Azure Data Sync -- TechEd NA 2013Pushing Data to and from the Cloud with SQL Azure Data Sync -- TechEd NA 2013
Pushing Data to and from the Cloud with SQL Azure Data Sync -- TechEd NA 2013
Woodruff Solutions LLC
 
Developing Mobile Solutions with Azure and Windows Phone VSLive! Redmond 2013
Developing Mobile Solutions with Azure and Windows Phone VSLive! Redmond 2013Developing Mobile Solutions with Azure and Windows Phone VSLive! Redmond 2013
Developing Mobile Solutions with Azure and Windows Phone VSLive! Redmond 2013
Woodruff Solutions LLC
 
Connecting to Data from Windows Phone 8 VSLive! Redmond 2013
Connecting to Data from Windows Phone 8 VSLive! Redmond 2013Connecting to Data from Windows Phone 8 VSLive! Redmond 2013
Connecting to Data from Windows Phone 8 VSLive! Redmond 2013
Woodruff Solutions LLC
 
AzureConf 2013 Developing Cross Platform Mobile Solutions with Azure Mobile...
AzureConf 2013   Developing Cross Platform Mobile Solutions with Azure Mobile...AzureConf 2013   Developing Cross Platform Mobile Solutions with Azure Mobile...
AzureConf 2013 Developing Cross Platform Mobile Solutions with Azure Mobile...
Woodruff Solutions LLC
 
Connecting to Data from Windows Phone 8
Connecting to Data from Windows Phone 8Connecting to Data from Windows Phone 8
Connecting to Data from Windows Phone 8
Woodruff Solutions LLC
 
Sql Azure Data Sync
Sql Azure Data SyncSql Azure Data Sync
Sql Azure Data Sync
Woodruff Solutions LLC
 
Producing an OData feed in 10 minutes
Producing an OData feed in 10 minutesProducing an OData feed in 10 minutes
Producing an OData feed in 10 minutes
Woodruff Solutions LLC
 
Build Conference Highlights: How Windows 8 Metro is Revolutionary
Build Conference Highlights: How Windows 8 Metro is RevolutionaryBuild Conference Highlights: How Windows 8 Metro is Revolutionary
Build Conference Highlights: How Windows 8 Metro is Revolutionary
Woodruff Solutions LLC
 
Sailing on the ocean of 1s and 0s
Sailing on the ocean of 1s and 0sSailing on the ocean of 1s and 0s
Sailing on the ocean of 1s and 0s
Woodruff Solutions LLC
 
Breaking down data silos with OData
Breaking down data silos with ODataBreaking down data silos with OData
Breaking down data silos with OData
Woodruff Solutions LLC
 
Breaking down data silos with the open data protocol
Breaking down data silos with the open data protocolBreaking down data silos with the open data protocol
Breaking down data silos with the open data protocol
Woodruff Solutions LLC
 
Developing Mobile Solutions with Azure Mobile Services in Windows 8.1 and Win...
Developing Mobile Solutions with Azure Mobile Services in Windows 8.1 and Win...Developing Mobile Solutions with Azure Mobile Services in Windows 8.1 and Win...
Developing Mobile Solutions with Azure Mobile Services in Windows 8.1 and Win...
Woodruff Solutions LLC
 
Connecting to Data from Windows Phone 8
Connecting to Data from Windows Phone 8Connecting to Data from Windows Phone 8
Connecting to Data from Windows Phone 8
Woodruff Solutions LLC
 
Pushing Data to and from the Cloud with SQL Azure Data Sync -- TechEd NA 2013
Pushing Data to and from the Cloud with SQL Azure Data Sync -- TechEd NA 2013Pushing Data to and from the Cloud with SQL Azure Data Sync -- TechEd NA 2013
Pushing Data to and from the Cloud with SQL Azure Data Sync -- TechEd NA 2013
Woodruff Solutions LLC
 
Developing Mobile Solutions with Azure and Windows Phone VSLive! Redmond 2013
Developing Mobile Solutions with Azure and Windows Phone VSLive! Redmond 2013Developing Mobile Solutions with Azure and Windows Phone VSLive! Redmond 2013
Developing Mobile Solutions with Azure and Windows Phone VSLive! Redmond 2013
Woodruff Solutions LLC
 
Connecting to Data from Windows Phone 8 VSLive! Redmond 2013
Connecting to Data from Windows Phone 8 VSLive! Redmond 2013Connecting to Data from Windows Phone 8 VSLive! Redmond 2013
Connecting to Data from Windows Phone 8 VSLive! Redmond 2013
Woodruff Solutions LLC
 
AzureConf 2013 Developing Cross Platform Mobile Solutions with Azure Mobile...
AzureConf 2013   Developing Cross Platform Mobile Solutions with Azure Mobile...AzureConf 2013   Developing Cross Platform Mobile Solutions with Azure Mobile...
AzureConf 2013 Developing Cross Platform Mobile Solutions with Azure Mobile...
Woodruff Solutions LLC
 
Connecting to Data from Windows Phone 8
Connecting to Data from Windows Phone 8Connecting to Data from Windows Phone 8
Connecting to Data from Windows Phone 8
Woodruff Solutions LLC
 
Build Conference Highlights: How Windows 8 Metro is Revolutionary
Build Conference Highlights: How Windows 8 Metro is RevolutionaryBuild Conference Highlights: How Windows 8 Metro is Revolutionary
Build Conference Highlights: How Windows 8 Metro is Revolutionary
Woodruff Solutions LLC
 
Breaking down data silos with the open data protocol
Breaking down data silos with the open data protocolBreaking down data silos with the open data protocol
Breaking down data silos with the open data protocol
Woodruff Solutions LLC
 
Ad

Recently uploaded (20)

Into The Box Conference Keynote Day 1 (ITB2025)
Into The Box Conference Keynote Day 1 (ITB2025)Into The Box Conference Keynote Day 1 (ITB2025)
Into The Box Conference Keynote Day 1 (ITB2025)
Ortus Solutions, Corp
 
How Can I use the AI Hype in my Business Context?
How Can I use the AI Hype in my Business Context?How Can I use the AI Hype in my Business Context?
How Can I use the AI Hype in my Business Context?
Daniel Lehner
 
Special Meetup Edition - TDX Bengaluru Meetup #52.pptx
Special Meetup Edition - TDX Bengaluru Meetup #52.pptxSpecial Meetup Edition - TDX Bengaluru Meetup #52.pptx
Special Meetup Edition - TDX Bengaluru Meetup #52.pptx
shyamraj55
 
How analogue intelligence complements AI
How analogue intelligence complements AIHow analogue intelligence complements AI
How analogue intelligence complements AI
Paul Rowe
 
HCL Nomad Web – Best Practices und Verwaltung von Multiuser-Umgebungen
HCL Nomad Web – Best Practices und Verwaltung von Multiuser-UmgebungenHCL Nomad Web – Best Practices und Verwaltung von Multiuser-Umgebungen
HCL Nomad Web – Best Practices und Verwaltung von Multiuser-Umgebungen
panagenda
 
Semantic Cultivators : The Critical Future Role to Enable AI
Semantic Cultivators : The Critical Future Role to Enable AISemantic Cultivators : The Critical Future Role to Enable AI
Semantic Cultivators : The Critical Future Role to Enable AI
artmondano
 
Designing Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep Dive
Designing Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep DiveDesigning Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep Dive
Designing Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep Dive
ScyllaDB
 
#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025
#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025
#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025
BookNet Canada
 
2025-05-Q4-2024-Investor-Presentation.pptx
2025-05-Q4-2024-Investor-Presentation.pptx2025-05-Q4-2024-Investor-Presentation.pptx
2025-05-Q4-2024-Investor-Presentation.pptx
Samuele Fogagnolo
 
Rusty Waters: Elevating Lakehouses Beyond Spark
Rusty Waters: Elevating Lakehouses Beyond SparkRusty Waters: Elevating Lakehouses Beyond Spark
Rusty Waters: Elevating Lakehouses Beyond Spark
carlyakerly1
 
Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...
Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...
Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...
BookNet Canada
 
DevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptx
DevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptxDevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptx
DevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptx
Justin Reock
 
Electronic_Mail_Attacks-1-35.pdf by xploit
Electronic_Mail_Attacks-1-35.pdf by xploitElectronic_Mail_Attacks-1-35.pdf by xploit
Electronic_Mail_Attacks-1-35.pdf by xploit
niftliyevhuseyn
 
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdfSAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
Precisely
 
Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...
Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...
Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...
Aqusag Technologies
 
Mobile App Development Company in Saudi Arabia
Mobile App Development Company in Saudi ArabiaMobile App Development Company in Saudi Arabia
Mobile App Development Company in Saudi Arabia
Steve Jonas
 
What is Model Context Protocol(MCP) - The new technology for communication bw...
What is Model Context Protocol(MCP) - The new technology for communication bw...What is Model Context Protocol(MCP) - The new technology for communication bw...
What is Model Context Protocol(MCP) - The new technology for communication bw...
Vishnu Singh Chundawat
 
IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...
IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...
IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...
organizerofv
 
Drupalcamp Finland – Measuring Front-end Energy Consumption
Drupalcamp Finland – Measuring Front-end Energy ConsumptionDrupalcamp Finland – Measuring Front-end Energy Consumption
Drupalcamp Finland – Measuring Front-end Energy Consumption
Exove
 
Quantum Computing Quick Research Guide by Arthur Morgan
Quantum Computing Quick Research Guide by Arthur MorganQuantum Computing Quick Research Guide by Arthur Morgan
Quantum Computing Quick Research Guide by Arthur Morgan
Arthur Morgan
 
Into The Box Conference Keynote Day 1 (ITB2025)
Into The Box Conference Keynote Day 1 (ITB2025)Into The Box Conference Keynote Day 1 (ITB2025)
Into The Box Conference Keynote Day 1 (ITB2025)
Ortus Solutions, Corp
 
How Can I use the AI Hype in my Business Context?
How Can I use the AI Hype in my Business Context?How Can I use the AI Hype in my Business Context?
How Can I use the AI Hype in my Business Context?
Daniel Lehner
 
Special Meetup Edition - TDX Bengaluru Meetup #52.pptx
Special Meetup Edition - TDX Bengaluru Meetup #52.pptxSpecial Meetup Edition - TDX Bengaluru Meetup #52.pptx
Special Meetup Edition - TDX Bengaluru Meetup #52.pptx
shyamraj55
 
How analogue intelligence complements AI
How analogue intelligence complements AIHow analogue intelligence complements AI
How analogue intelligence complements AI
Paul Rowe
 
HCL Nomad Web – Best Practices und Verwaltung von Multiuser-Umgebungen
HCL Nomad Web – Best Practices und Verwaltung von Multiuser-UmgebungenHCL Nomad Web – Best Practices und Verwaltung von Multiuser-Umgebungen
HCL Nomad Web – Best Practices und Verwaltung von Multiuser-Umgebungen
panagenda
 
Semantic Cultivators : The Critical Future Role to Enable AI
Semantic Cultivators : The Critical Future Role to Enable AISemantic Cultivators : The Critical Future Role to Enable AI
Semantic Cultivators : The Critical Future Role to Enable AI
artmondano
 
Designing Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep Dive
Designing Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep DiveDesigning Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep Dive
Designing Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep Dive
ScyllaDB
 
#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025
#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025
#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025
BookNet Canada
 
2025-05-Q4-2024-Investor-Presentation.pptx
2025-05-Q4-2024-Investor-Presentation.pptx2025-05-Q4-2024-Investor-Presentation.pptx
2025-05-Q4-2024-Investor-Presentation.pptx
Samuele Fogagnolo
 
Rusty Waters: Elevating Lakehouses Beyond Spark
Rusty Waters: Elevating Lakehouses Beyond SparkRusty Waters: Elevating Lakehouses Beyond Spark
Rusty Waters: Elevating Lakehouses Beyond Spark
carlyakerly1
 
Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...
Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...
Transcript: #StandardsGoals for 2025: Standards & certification roundup - Tec...
BookNet Canada
 
DevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptx
DevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptxDevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptx
DevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptx
Justin Reock
 
Electronic_Mail_Attacks-1-35.pdf by xploit
Electronic_Mail_Attacks-1-35.pdf by xploitElectronic_Mail_Attacks-1-35.pdf by xploit
Electronic_Mail_Attacks-1-35.pdf by xploit
niftliyevhuseyn
 
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdfSAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
Precisely
 
Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...
Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...
Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...
Aqusag Technologies
 
Mobile App Development Company in Saudi Arabia
Mobile App Development Company in Saudi ArabiaMobile App Development Company in Saudi Arabia
Mobile App Development Company in Saudi Arabia
Steve Jonas
 
What is Model Context Protocol(MCP) - The new technology for communication bw...
What is Model Context Protocol(MCP) - The new technology for communication bw...What is Model Context Protocol(MCP) - The new technology for communication bw...
What is Model Context Protocol(MCP) - The new technology for communication bw...
Vishnu Singh Chundawat
 
IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...
IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...
IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...
organizerofv
 
Drupalcamp Finland – Measuring Front-end Energy Consumption
Drupalcamp Finland – Measuring Front-end Energy ConsumptionDrupalcamp Finland – Measuring Front-end Energy Consumption
Drupalcamp Finland – Measuring Front-end Energy Consumption
Exove
 
Quantum Computing Quick Research Guide by Arthur Morgan
Quantum Computing Quick Research Guide by Arthur MorganQuantum Computing Quick Research Guide by Arthur Morgan
Quantum Computing Quick Research Guide by Arthur Morgan
Arthur Morgan
 

Learning How to Shape and Configure an OData Service for High Performing Web and Mobile Applications

  • 1. #devsum15 Learning How to Shape and Configure an OData Feed for High Performing Web Sites and Applications Chris Woodruff @cwoodruff [email protected]
  • 2. Hi, I’m Woody! Chris Woodruff • [email protected] • http://chriswoodruff.com • http://deepfriedbytes.com • twitter @cwoodruff
  • 3. VALIDATION CLIENT SIDEBEST PRACTICES AGENDA
  • 4. What are the 2 Sides of OData? SERVER-SIDE (PRODUCER) CLIENT-SIDE (CONSUMER)
  • 6. UNDERSTAND REST The Top Reasons You Need to Learn about Data in Your Windows Phone App
  • 9. WHAT SHOULD YOU KNOW ABOUT REST? Resources REST uses addressable resources to define the structure of the API. These are the URLs you use to get to pages on the web Request Headers These are additional instructions that are sent with the request. These might define what type of response is required or authorization details. Request Verbs These describe what you want to do with the resource. A browser typically issues a GET verb to instruct the endpoint it wants to get data, however there are many other verbs available including things like POST, PUT and DELETE. Request Body Data that is sent with the request. For example a POST (creation of a new item) will required some data which is typically sent as the request body in the format of JSON or XML. Response Body This is the main body of the response. If the request was to a web server, this might be a full HTML page, if it was to an API, this might be a JSON or XML document. Response Status codes These codes are issues with the response and give the client details on the status of the request.
  • 10. REST & HTTP VERBS GET Requests a representation of the specified Requests using GET should only retrieve have no other effect. POST Requests that the server accept the entity enclosed in the request as a new subordinate of the web resource identified by the URI. PUT Requests that the enclosed entity be stored under the supplied URI. DELETE Deletes the specified resource.
  • 11. EXAMPLES OF REST AND ODATA /Products RESOURCE EXPECTED OUTCOMEVERB RESPONSE CODE /Products?$filter=Color eq ‘Red' /Products /Products(81) /Products(881) /Products(81) /Products(81) GET GET POST GET GET PUT DELETE A list of all products in the system A list of all products in the system where the color is red Creation of a new product Product with an ID of 81 Some error message Update of the product with ID of 81 Deletion of the product with ID of 81 200/OK 200/OK 201/Created 200/OK 404/Not Found 204/No Content 204/No Content
  • 13. Get to know the OData Protocol!!!
  • 14. Examples (http://chinookdata.azurewebsites.net) GET serviceRoot/Artists?$filter=Name eq 'Foo Fighters' GET serviceRoot/Artists?$filter=contains(Name, 'Foo') GET serviceRoot/Artists(1)?$expand=Albums GET serviceRoot/Artists(58)/Albums?$orderby=Title desc GET serviceRoot/Artists?$skip=20&$top=10 GET serviceRoot/Artists?$search=AC *** GET serviceRoot/Customer?$filter=Email/any(s:endswith(s, 'contoso.com')) *** GET serviceRoot/$metadata
  • 16. Examples (http://chinookdata.azurewebsites.net) PROPERTIES OF THE CUSTOMER ENTITY • CustomerId • FirstName • LastName • Company • Address • City • State QUERY PROJECTIONS FOR PERFORMANCE GET serviceRoot/Customers?$select= FirstName, LastName, Company GET serviceRoot/Customers?$select= LastName, Address, City, State, Country, PostalCode GET serviceRoot/Customers?$select= FirstName, LastName, Phone, Email • Country • PostalCode • Phone • Fax • Email • SupportRepId
  • 21. Data Caching with Web API OData v4
  • 22. Example Add the CacheCow Server NuGet package to your server project.
  • 23. Example Add the following to your WebApiConfig.cs file: var cacheCowCacheHandler = new CachingHandler(config); config.MessageHandlers.Add(cacheCowCacheHandler); When you get a resource you will get an Etag ETag: W/”002a41972c3d43f0bb14d033907b3f41″ When you make a second request to the same resource, you should send this ETag. The server uses this identifier to check if the resource you requested has changed (remember, the server is the authoritative source). If the resource has indeed changed, it sends you the latest copy. Otherwise, it sends a 304 Not Modified.
  • 25. QUERYABLE ODATAATTRIBUTES AllowedFunctions Consider disabling the any() and all() functions, as these can be 0 5 IgnoreDataMember (not with Queryable) Represents an Attribute that can be placed on a property to specify that the property cannot be navigated in OData query. 0 6 PageSize Enable server-driven paging, to avoid returning a large data set in one query. For more information 0 1 AllowedQueryOptions Do you need $filter and $orderby? Some applications might allow client paging, using $top and $skip, but disable the other query options. 0 2 AllowedOrderByProperties Consider restricting $orderby to properties in a clustered index. Sorting large data without a clustered index is slow. 0 3 AllowedLogicalOperators Consider any logical operators that you do not want to allow 0 4
  • 26. Examples [EnableQuery(AllowedQueryOptions = AllowedQueryOptions.Filter)] [EnableQuery(AllowedLogicalOperators = AllowedLogicalOperators.Equal)] [EnableQuery(AllowedFunctions = AllowedFunctions.AllStringFunctions)] [EnableQuery(AllowedOrderByProperties = "ID")]
  • 27. ODATAATTRIBUTES (CONT) NotExpandable Represents an Attribute that can be placed on a property to specify be used in the $expand OData query option. 0 5 NotNavigable Represents an Attribute that can be placed on a property to specify that the property cannot be navigated in OData query. 0 6 NotSortable Represents an attribute that can be placed on a property to specify that the property cannot be used in the $orderby OData query option. 0 7 NonFilterable Represents an Attribute that can be placed on a property to specify that the property cannot be used in the $filter OData query option. 0 1 UnSortable Represents an Attribute that can be placed on a property to specify that the property cannot be used in the $orderby OData query option. 0 2 NotExpandable Represents an Attribute that can be placed on a property to specify that the property cannot be used in the $expand OData query option. 0 3 NotCountable Represents an Attribute that can be placed on a property to specify that the $count cannot be applied on the property. 0 4 [NonFilterable] [Unsortable] public string Name { get; set; }
  • 28. QUERY SECURITY Consider disabling the any() and all() functions, as these can be slow. 0 6 If any string properties contain large strings— for example, a product description or a blog entry—consider disabling the string functions. 0 7 Consider disallowing filtering on navigation properties. Filtering on navigation properties can result in a join, which might be slow, depending on your database schema. 0 8 Test your service with various queries and profile the DB. 0 1 Enable server-driven paging, to avoid returning a large data set in one query. 0 2 Do you need $filter and $orderby? Some applications might allow client paging, using $top and $skip, but disable the other query options. 0 3 Consider restricting $orderby to properties in a clustered index. Sorting large data without a clustered index is slow. 0 4 Consider restricting $filter queries by writing a validator that is customized for your database. 0 9 Maximum node count: The MaxNodeCount property on [Queryable] sets the maximum number nodes allowed in the $filter syntax tree. The default value is 100, but you may want to set a lower value, because a large number of nodes can be slow to compile. 0 5
  • 29. VALIDATION PATHS Filter Query Represents a validator used to validate a FilterQueryOption based on the ODataValidationSettings. Order By Query Represents a validator used to validate an OrderByQueryOption based on the ODataValidationSettings. OData Query Represents a validator used to validate OData queries based on the ODataValidationSettings. Select Expand Query Represents a validator used to validate a SelectExpandQueryOption based on the ODataValidationSettings. Skip Query Represents a validator used to validate a SkipQueryOption based on the ODataValidationSettings. Top Query Represents a validator used to validate a TopQueryOption based on the ODataValidationSettings.
  • 30. QUERY SECURITY // Validator to prevent filtering on navigation properties. public class MyFilterQueryValidator : FilterQueryValidator { public override void ValidateNavigationPropertyNode( Microsoft.Data.OData.Query.SemanticAst.QueryNode sourceNode, Microsoft.Data.Edm.IEdmNavigationProperty navigationProperty, ODataValidationSettings settings) { throw new ODataException("No navigation properties"); } } // Validator to restrict which properties can be used in $filter expressions. public class MyFilterQueryValidator : FilterQueryValidator { static readonly string[] allowedProperties = { "ReleaseYear", "Title" }; public override void ValidateSingleValuePropertyAccessNode( SingleValuePropertyAccessNode propertyAccessNode, ODataValidationSettings settings) { string propertyName = null; if (propertyAccessNode != null) { propertyName = propertyAccessNode.Property.Name; } if (propertyName != null && !allowedProperties.Contains(propertyName)) { throw new ODataException( String.Format("Filter on {0} not allowed", propertyName)); } base.ValidateSingleValuePropertyAccessNode(propertyAccessNode, settings); } }
  • 34. XODATA Web-based OData Visualizer FIDDLER Free web debugging tool which logs all HTTP(S) traffic between your computer and the Internet. LINQPAD (v3) Interactively query SQL databases (among other data sources such as OData or WCF Data Services) using LINQ, as well as interactively writing C# code without the need for an IDE. ODATA VALIDATOR Enable OData service authors to validate their implementation against the OData specification to ensure the service interoperates well with any OData client. TESTING/DEBUGGING ODATA www.websitename.com
  • 36. Demo Show How to Consume an OData Feed in an Universal App
  • 38. ODATA WORKSHOP 01 02 03 04 TESTING/DEBUGGING ODATA DEVELPING CLIENT SIDE SOLUTIONS • Web Apps using Javascript to consume Odata • iOS Swift development for native iPhone and iPad apps • Windows 8.1 and Windows Phone apps C# and WinJS • Android development using Java • Using Xamarin for consuming OData LEARNING THE PROTOCOL • The Metadata and Service Model of OData • URI Conventions of OData • Format Conventions of OData • OData HTTP Conventions and Operations DEVELPING SERVER SIDE SOLUTIONS • ASP.NET Web API • Advanced Performance Tips and Best Practices Go to http://ChrisWoodruff.com for more details and pricing
  • 39. THANK YOU Find me around the conference and would enjoy chatting Email: [email protected] Twitter: @cwoodruff

Editor's Notes

  • #12: 200 OK -- Standard response for successful HTTP requests. The actual response will depend on the request method used. In a GET request, the response will contain an entity corresponding to the requested resource. In a POST request the response will contain an entity describing or containing the result of the action. 201 Created -- The request has been fulfilled and resulted in a new resource being created. 204 No Content -- The server successfully processed the request, but is not returning any content. Usually used as a response to a successful delete request. 404 Not Found -- The requested resource could not be found but may be available again in the future. Subsequent requests by the client are permissible.
  • #26: // Disable any() and all() functions. [Queryable(AllowedFunctions= AllowedFunctions.AllFunctions & ~AllowedFunctions.All & ~AllowedFunctions.Any)]
  • #29: // Validator to prevent filtering on navigation properties. public class MyFilterQueryValidator : FilterQueryValidator { public override void ValidateNavigationPropertyNode( Microsoft.Data.OData.Query.SemanticAst.QueryNode sourceNode, Microsoft.Data.Edm.IEdmNavigationProperty navigationProperty, ODataValidationSettings settings) { throw new ODataException("No navigation properties"); } } // Validator to restrict which properties can be used in $filter expressions. public class MyFilterQueryValidator : FilterQueryValidator { static readonly string[] allowedProperties = { "ReleaseYear", "Title" }; public override void ValidateSingleValuePropertyAccessNode( SingleValuePropertyAccessNode propertyAccessNode, ODataValidationSettings settings) { string propertyName = null; if (propertyAccessNode != null) { propertyName = propertyAccessNode.Property.Name; } if (propertyName != null && !allowedProperties.Contains(propertyName)) { throw new ODataException( String.Format("Filter on {0} not allowed", propertyName)); } base.ValidateSingleValuePropertyAccessNode(propertyAccessNode, settings); } }