Your Data Everywhere, Part 3: Consuming LightSwitch's OData Services from Windows Phone Apps
- Overview of Developing for Windows Phone
- Securing an OData Service in LightSwitch
- Creating a Sample Application
- Creating the User Interface
- Connecting to the Service
- Working with Data
- Testing the Application
As discussed in part 1 and part 2 of this series, LightSwitch in Visual Studio 2012 produces OData feeds for every data source. This is a tremendous benefit because with OData you can expose data to a variety of client applications, including mobile applications. This article concludes this series by showing you how to create a Windows Phone app that is capable of working with OData feeds produced by LightSwitch.
Overview of Developing for Windows Phone
Windows Phone is Microsoft's most recent operating system for mobile devices. Microsoft has done a great job of offering a convenient development environment for building Windows Phone applications inside Visual Studio 2010, so that developers can use the IDE and programming languages they already know. You can build applications for Windows Phone 7 and 7.5 by installing the Windows Phone 7.1 SDK on your machine. At the time of writing, such developer tools were only available for Microsoft Visual Studio 2010, so you'll need this edition of the development environment to build mobile apps (which applies to the sample project discussed in this article). You can also take advantage of the free Visual Studio Express for Windows Phone. For the sake of consistency, in this article we use Visual Studio 2010.
Developing apps for Windows Phone relies on a version of Silverlight that is specific to Windows Phone, so if you have some experience with Silverlight or Windows Presentation Foundation (WPF), you're already familiar with building mobile apps for the new operating system. The Windows Phone developer tools install project templates, libraries, a device emulator required for local testing, and all the other necessary tools to help you as a Windows Phone developer.
OData Support in Windows Phone Development
As with other platforms, working with data on the Windows Phone OS is a key topic. For this reason, Windows Phone fully supports OData services through a special client library. This library is already included in the SDK, so you don't need to install anything else. The library is available through an assembly called System.Data.Services.Client.dll, which will be added for you automatically when you reach the OData service. I'll explain more shortly, but before we get to the mobile client, it's a good idea for you to understand how to secure the OData services produced by LightSwitch. This is very important when exposing your data through public networks such as the Internet.