![Page 1: Real-Time Web Applications with ASP.NET WebAPI and SignalR](https://reader036.vdocuments.net/reader036/viewer/2022081414/54c6f4464a7959e5658b45a5/html5/thumbnails/1.jpg)
Real-Time Web ApplicationsASP.NET WebAPI & SignalRJim Wang
![Page 2: Real-Time Web Applications with ASP.NET WebAPI and SignalR](https://reader036.vdocuments.net/reader036/viewer/2022081414/54c6f4464a7959e5658b45a5/html5/thumbnails/2.jpg)
ASP.NET Web API
Jim Wang
![Page 3: Real-Time Web Applications with ASP.NET WebAPI and SignalR](https://reader036.vdocuments.net/reader036/viewer/2022081414/54c6f4464a7959e5658b45a5/html5/thumbnails/3.jpg)
How to reach more clients?
Browsers Devices Phones Tablets
? ? ? ?
App
![Page 4: Real-Time Web Applications with ASP.NET WebAPI and SignalR](https://reader036.vdocuments.net/reader036/viewer/2022081414/54c6f4464a7959e5658b45a5/html5/thumbnails/4.jpg)
How to make it scale?
Browsers Devices Phones Tablets
App
? ? ? ?
![Page 5: Real-Time Web Applications with ASP.NET WebAPI and SignalR](https://reader036.vdocuments.net/reader036/viewer/2022081414/54c6f4464a7959e5658b45a5/html5/thumbnails/5.jpg)
How to keep it simple?
Browsers Devices Phones Tablets
App
? ? ? ?SOAPSOAP
.config
![Page 6: Real-Time Web Applications with ASP.NET WebAPI and SignalR](https://reader036.vdocuments.net/reader036/viewer/2022081414/54c6f4464a7959e5658b45a5/html5/thumbnails/6.jpg)
Leverage the Web – build Web APIs
Browsers Devices Phones Tablets
ASP.NET Web APIApp
![Page 7: Real-Time Web Applications with ASP.NET WebAPI and SignalR](https://reader036.vdocuments.net/reader036/viewer/2022081414/54c6f4464a7959e5658b45a5/html5/thumbnails/7.jpg)
ASP.NET Web API
A framework for creating HTTP services that can reach a
broad range of clients including browsers and mobile devices
![Page 8: Real-Time Web Applications with ASP.NET WebAPI and SignalR](https://reader036.vdocuments.net/reader036/viewer/2022081414/54c6f4464a7959e5658b45a5/html5/thumbnails/8.jpg)
features
First class modern HTTP programming model
Easily map resources to URIs
Content negotiation Request validation Flexible hosting Lightweight .NET 4+
Available as NuGet packages
Great templates and tooling in 2012.2 release, like help pages
Fully open source
![Page 9: Real-Time Web Applications with ASP.NET WebAPI and SignalR](https://reader036.vdocuments.net/reader036/viewer/2022081414/54c6f4464a7959e5658b45a5/html5/thumbnails/9.jpg)
ASP.NET Web API OData
Components for implementing OData servicesModel builders, formatters (Atom/JSON/XML), path and query parsers, LINQ expression generator, etc
Support common patterns using an open protocolEx. query, paging, relationships, metadata
Built on ODataLibSame underpinnings as WCF Data Services
Open source and accepting contributionshttp://aspnetwebstack.codeplex.com
![Page 10: Real-Time Web Applications with ASP.NET WebAPI and SignalR](https://reader036.vdocuments.net/reader036/viewer/2022081414/54c6f4464a7959e5658b45a5/html5/thumbnails/10.jpg)
Three Steps to Get Started
Create your EDM
Configure your OData Route
Implement an OData Controller
ODataConventionModelBuilder modelBuilder = new ODataConventionModelBuilder();modelBuilder.EntitySet<Movie>("Movies");IEdmModel model = modelBuilder.GetEdmModel();
config.Routes.MapODataRoute(routeName: "OData", routePrefix: "odata", model: model);
public class MoviesController : EntitySetController<Movie, int> {...}
![Page 11: Real-Time Web Applications with ASP.NET WebAPI and SignalR](https://reader036.vdocuments.net/reader036/viewer/2022081414/54c6f4464a7959e5658b45a5/html5/thumbnails/11.jpg)
Data Model for OData
The ASP.NET Web API core runtime has no data modelObjects 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 youProvide metadata, setup routes, rich link generation, query, paging
Your OData EDM can be different from your EF EDMYou don’t even need an EF EDM – use any data source you’d like
![Page 12: Real-Time Web Applications with ASP.NET WebAPI and SignalR](https://reader036.vdocuments.net/reader036/viewer/2022081414/54c6f4464a7959e5658b45a5/html5/thumbnails/12.jpg)
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 IQueryableTranslate the Abstract Syntax Tree to your query mechanism of choice
Query validationRestrict supported query options, functions, expression operators, queryable properties, etc.
Paging Set PageSize to your desired max page size
![Page 13: Real-Time Web Applications with ASP.NET WebAPI and SignalR](https://reader036.vdocuments.net/reader036/viewer/2022081414/54c6f4464a7959e5658b45a5/html5/thumbnails/13.jpg)
what’s next?
Security with OAuth2, JWT OData $expand, $select Odata scaffolding for templates SignalR integration CORS, JSONP
![Page 14: Real-Time Web Applications with ASP.NET WebAPI and SignalR](https://reader036.vdocuments.net/reader036/viewer/2022081414/54c6f4464a7959e5658b45a5/html5/thumbnails/14.jpg)
signalR
Jim Wang
![Page 15: Real-Time Web Applications with ASP.NET WebAPI and SignalR](https://reader036.vdocuments.net/reader036/viewer/2022081414/54c6f4464a7959e5658b45a5/html5/thumbnails/15.jpg)
what is it?
SignalR : Incredibly simple real-time for ASP.NET Automatic protocol negotiation
Simplicity Reach Performance
![Page 16: Real-Time Web Applications with ASP.NET WebAPI and SignalR](https://reader036.vdocuments.net/reader036/viewer/2022081414/54c6f4464a7959e5658b45a5/html5/thumbnails/16.jpg)
where are we?
github.com/SignalR/SignalRTaking pull requests!
1.0 RTW with ASP.NET 2012.2Available now.
![Page 17: Real-Time Web Applications with ASP.NET WebAPI and SignalR](https://reader036.vdocuments.net/reader036/viewer/2022081414/54c6f4464a7959e5658b45a5/html5/thumbnails/17.jpg)
clients
Today jQuery .NET 4.0+ Silverlight 5 Windows Phone 8 .NET for Windows Store
apps
Future? Pure JavaScript (no jQuery) C++ (Windows Store &
Embedded) MonoTouch/MonoDroid Objective C Java …
![Page 18: Real-Time Web Applications with ASP.NET WebAPI and SignalR](https://reader036.vdocuments.net/reader036/viewer/2022081414/54c6f4464a7959e5658b45a5/html5/thumbnails/18.jpg)
what’s next?
Monthly point releases More documentation and samples More templates and scaffolding Scale out
Service Bus SQL Server Redis
![Page 19: Real-Time Web Applications with ASP.NET WebAPI and SignalR](https://reader036.vdocuments.net/reader036/viewer/2022081414/54c6f4464a7959e5658b45a5/html5/thumbnails/19.jpg)
knockout.js
Jim Wang
![Page 20: Real-Time Web Applications with ASP.NET WebAPI and SignalR](https://reader036.vdocuments.net/reader036/viewer/2022081414/54c6f4464a7959e5658b45a5/html5/thumbnails/20.jpg)
features
![Page 21: Real-Time Web Applications with ASP.NET WebAPI and SignalR](https://reader036.vdocuments.net/reader036/viewer/2022081414/54c6f4464a7959e5658b45a5/html5/thumbnails/21.jpg)
let’s build.
Jim Wang
![Page 22: Real-Time Web Applications with ASP.NET WebAPI and SignalR](https://reader036.vdocuments.net/reader036/viewer/2022081414/54c6f4464a7959e5658b45a5/html5/thumbnails/22.jpg)
get ASP.NET and Web Tools 2012.2www.asp.net/vnextDownloads it through the Web Platform Installer
![Page 23: Real-Time Web Applications with ASP.NET WebAPI and SignalR](https://reader036.vdocuments.net/reader036/viewer/2022081414/54c6f4464a7959e5658b45a5/html5/thumbnails/23.jpg)
links
Knockout.jshttp://knockoutjs.com
Bootstraphttp://twitter.github.com/bootstrap/
OData Security Guidance for Web APIhttp://www.asp.net/web-api/overview/odata-support-in-aspnet-web-api/odata-security-guidance