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
Web 2.0: Building Data Driven RESTful Applications with Microsoft Tools
Stephen [email protected]://stephenforte.net
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
Agenda• What is REST?• What is ADO .NET Data Services
(Astoria)?• Consuming ADO .NET Data Services
Data• Futures: WCF REST Starter Kit, Astoria
Offline
Agenda• What is REST?• What is ADO .NET Data Services
(Astoria)?• Consuming ADO .NET Data Services
Data• Futures: WCF REST Starter Kit, Astoria
Offline
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}
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
Agenda• What is REST?• What is ADO .NET Data Services
(Astoria)?• Consuming ADO .NET Data Services
Data• Futures: WCF REST Starter Kit, Astoria
Offline
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
Demo-ADO .NET Data Services Walk Through
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
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
Demo-Service Operations, Query Interceptors
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!
Agenda• What is REST?• WCF REST Starter Kit• What is ADO .NET Data Services
(Astoria)?• Consuming ADO .NET Data Services
Data• Futures: Astoria Offline
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
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
Demo-Server Side ASP .NET DatabindingChange Interceptors
Programming from Silverlight 2.0• Full LINQ to Astoria support via a
proxy• Must consume all services
asynchronously
Demo-Silverlight 2.0 databinding via LINQ to Astoria
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
Agenda• What is REST?• What is ADO .NET Data Services
(Astoria)?• Consuming ADO .NET Data Services
Data• Futures: WCF REST Starter Kit, Astoria
Offline
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
Astoria Offline• Ability to take an Astoria service
offline
Questions?