Introduction

This is a more polished version of a talk I’ve given at several code camps lately.  It’s essentially the same content, I’ve changed the database and story a little, polished the code slightly, but the techniques and content are the same.

Architecture

Our database will be hosted on SQL Azure.  We’ll host a WCF service as a Web Role on Azure, and our sample Windows Phone 7 application will be destined for a phone.  Pretty simple, and this will be a common design pattern.

If an Azure account or Windows Phone 7 isn’t available, that’s OK.  This entire sample can be done with a local instance of SQL Server, the local Azure development fabric and the Windows Phone 7 emulator.

Required Tools

There are a lot of moving parts here, and exactly what you need to install depends on what you have.  You can do this entire sample using only free tools.

For the database, you’ll need either SQL Azure, or a local instance of SQL Server or SQL Server Express.

To develop the WCF service, you’ll need a form of Visual Studio and the local development fabric installed.  You’ll also need to install a few hotfixes, depending on your version of Windows and Visual Studio.  Visit http://www.microsoft.com/windowsazure/ to download what you need.

To develop the Windows Phone 7 application, you need a form of Visual Studio and the WP7 emulator.  Visit http://create.msdn.com/en-US to download the tools you need.

Database

For this sample, we’ll use the AdventureWorksDW database.  This is part of the AdventureWorks sample databases found at http://msftdbprodsamples.codeplex.com/.  I use AdventureWorksDW for a couple of reasons.  Firstly, in the Adventure Works series, the DW designates this is the “Data Warehouse”.  The schema is far less normalized and considerably simpler.  Because of its simplicity, this database can be migrated to SQL Azure.

Choose the version suitable for your instance of SQL Server—I used the 2008 R2 edition.  I was able to migrate AdventureWorksDW to SQL Azure; I recapped the process at http://c1.ms/b8ylik