24
Web 2.0: Building Data Driven RESTful Applications with Microsoft Tools Stephen Forte [email protected] http://stephenforte.net

Web 2.0: Building Data Driven RESTful Applications with Microsoft Tools

  • Upload
    kreeli

  • View
    31

  • Download
    0

Embed Size (px)

DESCRIPTION

Web 2.0: Building Data Driven RESTful Applications with Microsoft Tools. Stephen Forte [email protected] http://stephenforte.net. http://speaker/( ‘forte ’)/bio. Chief Strategy Officer of Telerik Certified Scrum Master Active in the Community: - PowerPoint PPT Presentation

Citation preview

Page 1: Web 2.0: Building Data Driven  RESTful  Applications with Microsoft Tools

Web 2.0: Building Data Driven RESTful Applications with Microsoft Tools

Stephen [email protected]://stephenforte.net

Page 2: Web 2.0: Building Data Driven  RESTful  Applications with Microsoft Tools

http://speaker/(‘forte’)/bio• Chief Strategy Officer of Telerik• Certified Scrum Master• Active in the Community:• International Conference Speaker for 12+ Years• RD, MVP and INETA Speaker • Co-moderator & founder of NYC .NET

Developers Group http://www.nycdotnetdev.com• Wrote a few books: SQL Server 2008 Developers

Guide (MS Press)• MBA from the City University of New York• Past:• CTO and co-Founder of Corzen, Inc. (TXV: WAN)• CTO of Zagat Survey

Page 3: Web 2.0: Building Data Driven  RESTful  Applications with Microsoft Tools

Agenda• What is REST?• What is ADO .NET Data Services

(Astoria)?• Consuming ADO .NET Data Services

Data• Futures: WCF REST Starter Kit, Astoria

Offline

Page 4: Web 2.0: Building Data Driven  RESTful  Applications with Microsoft Tools

Agenda• What is REST?• What is ADO .NET Data Services

(Astoria)?• Consuming ADO .NET Data Services

Data• Futures: WCF REST Starter Kit, Astoria

Offline

Page 5: Web 2.0: Building Data Driven  RESTful  Applications with Microsoft Tools

What is REST?• Representational State Transfer• An architectural style developed by Roy

Fielding• Resource based not RPC based

• Based on HTTP• Standard resource formats• Stateless communication between client and

server• GET, POST, PUT, DELETE• Addressable resources + hyperlinkinghttp://example.com/users/

http://example.com/users/{user}http://example.com/locations/ http://example.com/locations/{location}

Page 6: Web 2.0: Building Data Driven  RESTful  Applications with Microsoft Tools

Web Services v RESTWeb Services• Protocol Independent • RPC Focused• Method (Action) Based• XML Based (SOAP)

REST• HTTP only• Resource Focused• URI Based• XML, RSS, ATOM,

XHTML, JSON, and others

Page 7: Web 2.0: Building Data Driven  RESTful  Applications with Microsoft Tools

Agenda• What is REST?• What is ADO .NET Data Services

(Astoria)?• Consuming ADO .NET Data Services

Data• Futures: WCF REST Starter Kit, Astoria

Offline

Page 8: Web 2.0: Building Data Driven  RESTful  Applications with Microsoft Tools

ADO .NET Data Services• Framework from Microsoft that that facilitates the

creation of RESTful data services via HTTP endpoints• Shipped with .NET 3.5 SP1

• Built on top of WCF• Data representation in ATOM or JSON

• Automates the exposure of data as RESTful resources• Anything that implements IQueryable<T> and

IUpdatable<T>• Entity Framework• 3rd party ORMs• LINQ to SQL, custom data driven CLR classes

• Custom URI based querying

Page 9: Web 2.0: Building Data Driven  RESTful  Applications with Microsoft Tools

Demo-ADO .NET Data Services Walk Through

Page 10: Web 2.0: Building Data Driven  RESTful  Applications with Microsoft Tools

Service Operations• Additional way to expose resources

via URIs• [WebGet] is used for an addressable

query• [WebInvoke] is used for insert, update,

and delete• Can return a scalar value• IEnumerable or IQueryable • Astoria’s URI exposes the Service

Operation• If you use IQueryable you can append

query strings to the URI

Page 11: Web 2.0: Building Data Driven  RESTful  Applications with Microsoft Tools

Data Interceptors• Query Interceptors• Logic that will run when a resource is

requested• Can be used to limit the data viewed,

log, or perform security check• Change Interceptors• Logic that will run when a change

(Add/Edit/Delete) request is made

Page 12: Web 2.0: Building Data Driven  RESTful  Applications with Microsoft Tools

Demo-Service Operations, Query Interceptors

Page 13: Web 2.0: Building Data Driven  RESTful  Applications with Microsoft Tools

Securing ADO .NET Data Services• Using the Host’s authentication model• Role based authorization• EntitySetRights• Hiding Sensitive Data• [IgnoreProperties]

• QueryInterceptors• ServiceOperations to validate users• Brute force: HTTPS, SSL, IP Filtering• SQL Server Security should not be ignored

either!

Page 14: Web 2.0: Building Data Driven  RESTful  Applications with Microsoft Tools

Agenda• What is REST?• WCF REST Starter Kit• What is ADO .NET Data Services

(Astoria)?• Consuming ADO .NET Data Services

Data• Futures: Astoria Offline

Page 15: Web 2.0: Building Data Driven  RESTful  Applications with Microsoft Tools

Programming ADO.NET Data Services• Client side querying via LINQ to

ADO .NET Data Services• Proxy • Non Proxy

• HTTP Requests for non-Microsoft .NET Clients• GET• POST• PUT• DELETE

Page 16: Web 2.0: Building Data Driven  RESTful  Applications with Microsoft Tools

Programming from ASP .NET• Server Side• Generate a Proxy and use LINQ to

ADO.NET Data Services• Supports full databinding• Updateable

• Client Side (Microsoft AJAX)• Need ASP 4.0 JavaScript Preview 3 or

better (still beta)• Client side API facilitates client side calls to

Astoria from JavaScript• Client side HTML template binding

Page 17: Web 2.0: Building Data Driven  RESTful  Applications with Microsoft Tools

Demo-Server Side ASP .NET DatabindingChange Interceptors

Page 18: Web 2.0: Building Data Driven  RESTful  Applications with Microsoft Tools

Programming from Silverlight 2.0• Full LINQ to Astoria support via a

proxy• Must consume all services

asynchronously

Page 19: Web 2.0: Building Data Driven  RESTful  Applications with Microsoft Tools

Demo-Silverlight 2.0 databinding via LINQ to Astoria

Page 20: Web 2.0: Building Data Driven  RESTful  Applications with Microsoft Tools

Cross Domain Concerns• Need your domain in

crossdomain.xml or clientaccesspolicy.xml

• If not, build a web service in the same project to consume the Astoria service• Re-expose to Silverlight via WCF• Consume via Linq to XML• Updates need to handled separately

Page 21: Web 2.0: Building Data Driven  RESTful  Applications with Microsoft Tools

Agenda• What is REST?• What is ADO .NET Data Services

(Astoria)?• Consuming ADO .NET Data Services

Data• Futures: WCF REST Starter Kit, Astoria

Offline

Page 22: Web 2.0: Building Data Driven  RESTful  Applications with Microsoft Tools

WCF REST Starter Kit• CodePlex download that gives Visual

Studio SP1:• New WCF RESTful Templates

• Kit expands the http capabilities in WCF

• Can build RESTful services• Can consume RESTful services• Including from Ruby, etc

Page 23: Web 2.0: Building Data Driven  RESTful  Applications with Microsoft Tools

Astoria Offline• Ability to take an Astoria service

offline

Page 24: Web 2.0: Building Data Driven  RESTful  Applications with Microsoft Tools

Questions?