7. ASP.NET Web API
A framework for creating HTTP
services that can reach a broad range
of clients including browsers and mobile
devices
8. features
First class modern HTTP Available as NuGet packages
programming model Great templates and tooling in
Easily map resources to URIs 2012.2 release, like help pages
Content negotiation Fully open source
Request validation
Flexible hosting
Lightweight
.NET 4+
9. ASP.NET Web API OData
Components for implementing OData services
Model builders, formatters (Atom/JSON/XML), path and query parsers, LINQ expression generator, etc
Support common patterns using an open protocol
Ex. query, paging, relationships, metadata
Built on ODataLib
Same underpinnings as WCF Data Services
Open source and accepting contributions
http://aspnetwebstack.codeplex.com
10. Three Steps to Get Started
Create your EDM
ODataConventionModelBuilder modelBuilder = new ODataConventionModelBuilder();
modelBuilder.EntitySet<Movie>("Movies");
IEdmModel model = modelBuilder.GetEdmModel();
Configure your OData Route
config.Routes.MapODataRoute(routeName: "OData", routePrefix: "odata", model: model);
Implement an OData Controller
public class MoviesController : EntitySetController<Movie, int> {...}
11. Data Model for OData
The ASP.NET Web API core runtime has no data
model
Objects formatted to/from opaque blobs by formatters
OData is based on the Entity Data Model (EDM)
Entity sets, entities, relationships, complex types, actions, functions
Having a data model means the framework can do
more for you
Provide metadata, setup routes, rich link generation, query, paging
Your OData EDM can be different from your EF
EDM
12. Query Support
[Queryable] action filter enables OData query
support
Can be used independent of the format
ODataQueryOptions provides the parsed query
AST
Apply the query to an IQueryable
Translate the Abstract Syntax Tree to your query mechanism of choice
Query validation
Restrict supported query options, functions, expression operators, queryable properties, etc.
Paging
Set PageSize to your desired max page size
17. clients
Today Future?
jQuery Pure JavaScript (no jQuery)
.NET 4.0+ C++ (Windows Store & Embedded)
Silverlight 5 MonoTouch/MonoDroid
Windows Phone 8 Objective C
.NET for Windows Store apps Java
…
18. what’s next?
Monthly point releases
More documentation and samples
More templates and scaffolding
Scale out
Service Bus
SQL Server
Redis