Providing data to your Windows 8 App? See The Data Services Series.
Join the DZone community and get the full member experience.Join For Free
In this series, I'm exploring a variety of ways to build back-end data storage and services for Windows 8 apps (many of which, BTW, can also be used for other mobile and web apps as well). Here are the posts so far:
- Overview – High-level view of some of the available platform technologies, and a discussion of the game leaderboard scenario I'm using to demonstrate them, as well as the games I'm using for my demos.
- Building Back-end Data and Services for Windows 8 Apps: OData – Part 1 – Creating the database and schema, using Entity Framework to model the data store, and using WCF Data Services to expose the model via as a RESTful service with rich queryability.
In this post, I'm going to show you how I can implement the same leaderboard service using a relatively new member of the ASP.NET stack, Web API. Web API is designed specifically for building services that are accessed via HTTP, and is a lightweight, yet highly customizable way of building RESTful services, and even supports OData as well. I'll also show you how easy it is to host services built using ASP.NET Web API using the new Windows Azure Web Sites feature.
For the sake of simplicity, I'm going to leverage the same database schema that I created in part 1 of the WCF Data Services-based solution, and will also leverage Entity Framework for modeling the data. If you have not already, you should read through the sections entitled "Creating the Database" and "Creating the Schema" in that post, before moving on. I'll wait.
This is a series I've been following for a while and thought it was about time I blog about it. So here I am, blogging about it... ;)
Published at DZone with permission of Greg Duncan, DZone MVB. See the original article here.
Opinions expressed by DZone contributors are their own.