240 likes | 369 Vues
DEV312 Custom OData Services: Inside Some of The Top OData Services. Jonathan Carter Microsoft Corporation joncart@microsoft.com @ lostintangent. What questions will we address?. What is the current OData services landscape?
E N D
DEV312Custom OData Services:Inside Some of The Top OData Services Jonathan Carter Microsoft Corporation joncart@microsoft.com @lostintangent
What questions will we address? • What is the current OData services landscape? • What are best practices/lessons learned from these services? • How are these services actually built and what scenarios commonly exist?
Build your own • Use an existing framework (e.g. WCF Data Services, odata4j) • Host your data in the Windows Azure Marketplace DataMarket
WCF Data Services HTTP WCF Data Services Business Logic/Authentication/Authorization Entity Framework Provider Reflection Provider Custom Providers (DSP) Entity Framework .NET Types + IQueryable
Top 5 Best Practices (and one nit pick) • Set entity set page sizes (500 is “recommended”) • Use output caching when appropriate • Configure your “friendly feeds” • Use routing for “pretty URLs” • Include support for cross-domain restricted clients • Entity set ordering
Best Practices Demo
Services over databases HTTP Aggressive caching Limit amount of work per request WCF Data Services Typical public catalogs need no business logic Business Logic Entity Framework Entity Framework mappings for reshaping Feed customizations Catalog on SQL Azure Batch job uploads daily
SQL + EF best practices • Database • Create a dedicated DB when possible • Shaping flexibility • Performance tuning opportunities • Model • Favor relationships • Flatten commonly used navigation paths • Define “virtual” entities • Leverage complex types for organization • Name properties intuitively
Model Design Demo
Services over small in-memory data HTTP Caching, work limits, etc. WCF Data Services No need to worry about query translation LINQ to Objects Repository/.NET Types Simple wrapper presents data in terms of .NET types Data source Data read in whole collections
Service over queryable backend HTTP Insights Caching, work limits, etc. WCF Data Services Most business logic is for authentication Reflection/Custom LINQ translator LINQ translator does Expression FQL Data source Data source is the Facebook web API using FQL
Service over APIs HTTP Caching, work limits, etc. WCF Data Services Most business logic is for authentication Reflection/Custom LINQ translator LINQ translator does partial translation into function calls Repository RPC-ish APIs (SOAP, HTTP, etc.) Service API
Custom Queryable Demo
More scenarios • Aggregate services • Data sources that combine one or more back-ends • Some API-based, some database-based • Updates • IDataServiceUpdateProvider enables updatability
In Summary • Liberate your data • Internally • Externally if it makes sense • Empower your users • “Users” could be your own employees • Get involved with OData
Session Evaluations Tell us what you think, and you could win! All evaluations submitted are automatically entered into a daily prize draw* Sign-in to the Schedule Builder at http://europe.msteched.com/topic/list/ * Details of prize draw rules can be obtained from the Information Desk.
© 2010 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.