Real-Time Web Applications with ASP.NET WebAPI and SignalR

Post on 27-Jan-2015

120 views 4 download

Tags:

description

More info on http://www.techdays.be

Transcript of Real-Time Web Applications with ASP.NET WebAPI and SignalR

Real-Time Web ApplicationsASP.NET WebAPI & SignalRJim Wang

ASP.NET Web API

Jim Wang

How to reach more clients?

Browsers Devices Phones Tablets

? ? ? ?

App

How to make it scale?

Browsers Devices Phones Tablets

App

? ? ? ?

How to keep it simple?

Browsers Devices Phones Tablets

App

? ? ? ?SOAPSOAP

.config

Leverage the Web – build Web APIs

Browsers Devices Phones Tablets

ASP.NET Web APIApp

ASP.NET Web API

A framework for creating HTTP services that can reach a

broad range of clients including browsers and mobile devices

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

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

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> {...}

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

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

what’s next?

Security with OAuth2, JWT OData $expand, $select Odata scaffolding for templates SignalR integration CORS, JSONP

signalR

Jim Wang

what is it?

SignalR : Incredibly simple real-time for ASP.NET Automatic protocol negotiation

Simplicity Reach Performance

where are we?

github.com/SignalR/SignalRTaking pull requests!

1.0 RTW with ASP.NET 2012.2Available now.

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 …

what’s next?

Monthly point releases More documentation and samples More templates and scaffolding Scale out

Service Bus SQL Server Redis

knockout.js

Jim Wang

features

let’s build.

Jim Wang

get ASP.NET and Web Tools 2012.2www.asp.net/vnextDownloads it through the Web Platform Installer

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

questions?

Jim Wang@turanukjim.wang@microsoft.com