250 likes | 347 Vues
Modeling RESTful Data Services: Present and Future. Pablo Castro Software Architect Microsoft Corporation. Agenda. On data services for the web Modeling data services Structure Security Behavior What’s next… Short- and long-term plans. Scenarios for Data Services.
E N D
Modeling RESTful Data Services: Present and Future Pablo Castro Software Architect Microsoft Corporation
Agenda • On data services for the web • Modeling data services • Structure • Security • Behavior • What’s next… • Short- and long-term plans
What does the service look like? Service structure
Service Structure • Flexible interface != database interface • Model as appropriate for a service interface • Application-level concepts • Latency, payload size considerations • Consider optimistic concurrency requirements • Server-side schema versus service schema • Access rights control service level schema • Hidden, read-only, non-queryable, POST-only sets • Maintain full capability for server-side code
Who can access the service? Authentication
Authentication • Consider your target scenario • AJAX/Silverlight applications • “Forms” authentication works well • Login in HTML forms or within Silverlight • Wide-open RESTful service interface • Standard schemes much more important • Basic + SSL often does it • Digest, certificates provide more robust options • “Integrated” is great for corporate networks
Who can do what with the service? Access Control
Access Control • Use query and change interceptors • Policies that apply regardless of access path • Query path composition-based, highly efficient • Role-based access control • For actions • Row-level security • For entities
Behaviors in a resource-centric interface? State-based behavior
Behavior on State Transitions • Custom methods break the uniform interface • Still possible if needed: “Service operations” • Consider WCF/SOAP service if it’s all methods • Behavior attached to state transitions • ProcessSalesOrder() Order.Status=“Ready” • Change interceptors to detect transitions • Perform secondary side-effects • Kick-off workflows • …
What's next… Short and long term plans
announcing ADO.NET Data Services v1.5, CTP 1
ADO.NET Data Services v1.5 • Focused on service capabilities • Row count – everybody asked for this :) • Feed customization • BLOBs with streaming interface for media • Data-binding for the .NET and Silverlight • Server-driven paging • “Fancy” providers with full flexibility • Installs without overwriting 1.0 runtime • CTP1 available now, RTM around this fall
ASP.NET AJAX and Data Services • New version of ASP.NET AJAX coming • Preview 4 available in codeplexnow • Built-in support for Data Services • Great templates and data binding features • It all works together
SQL Data Services • SDS full relational store in the cloud • Use existing applications and know-how • Use existing database APIs • Host in Azure or access over the Internet Use Data Services for a REST interface over SDS Azure Client/ Browser SDS Web App Azure Client/ Server/ Browser SDS
.NET RIA Services • Asks for Data Services programming model • Server: Better business logic framework • Client: Better UI and validation integration • Integrate with “Domain Service” classes • .NET RIA Services use Data Services for queries, updates and data exchange • Author Data Services using .NET RIA Services
.NET RIA Services public class CatalogService : DataService<Catalog> { // initialization, interceptors, etc. } public class Catalog : LinqToEntitiesDomainService<BikesEntities> { public IQueryable<Product> GetProducts() { return Context.Products .Where(p => p.Status == "Active"); } public void UpdateProduct(Product current, Product original) { // ... } } Data Service exposes domain through RESTful interface Domain Service encapsulates business logic
"Astoria Offline" • Sync-enabled service interfaces • End-to-end solution for building offline applications • Client and server libraries, Visual Studio integration, etc. • Standard disclaimer: early exploration, just thoughts for now :)
Summary • You can build fully functional RESTful services with ADO.NET Data Services • Behaviors, access control, etc. can be modeled using a resource-centric interface • We are extending data services to provide more base functionality • Future focus on better business logic programming model and sync/offline
Resources • Data Services Team Blog • http://blogs.msdn.com/astoriateam • ADO.NET Data Services page @ MSDN • http://msdn.microsoft.com/data • ADO.NET Data Services forums • http://social.msdn.microsoft.com/Forums/en-US/adodotnetdataservices/threads/
Please Complete an Evaluation FormYour feedback is important! • Evaluation forms can be found on each chair • Temp Staff at the back of the room have additional evaluation form copies
© 2009 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.