Book Image

Windows Phone 7.5 Data Cookbook

By : Ramesh Thalli
Book Image

Windows Phone 7.5 Data Cookbook

By: Ramesh Thalli

Overview of this book

Windows Phone 7.5 Mango contains support for apps written in Silverlight or XNA. These apps can store data on the device, and also load and manipulate data from "the cloud" and other web services.This Windows Phone 7.5 Data Cookbook has a range of recipes to help you apply data handling concepts. You will be able to apply the knowledge gained from these recipes to build your own apps effectively. This Windows Phone 7.5 Data Cookbook starts with data binding concepts at the UI layer and then shows different ways of saving data locally and externally in databases. The book ends with a look at the popular MVVM software design pattern. The recipes contained in this book will make you an expert in the areas of data access and storage.
Table of Contents (15 chapters)
Windows Phone 7.5 Data Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Using LINQ to SQL for creating the service


LINQ to SQL is the family of LINQ technologies targeting relational databases where data is mapped as objects. LINQ to SQL provides the fastest way to create an interface to the backend. The only disadvantage is it can only map one level of relationship. So, if you need deeper relationship management, the Entity Framework is the way to go. Some of the features of LINQ to SQL are as follows:

  • Translates LINQ expression to T-SQL (Transact-SQL)

  • Provides an easy way to query objects instead of SQL statements

  • Has the ability to create databases and tables in the database

  • Provides a way to query the database using regular T-SQL statements

In this recipe, let's build the MyTask service like the preceding recipe, but instead of using the Entity Framework we will use LINQ to SQL classes.

Getting ready

Open the Visual Studio and create a new project using the WCF Service Application template and name it Recipe4_LINQToSQL under the CH7 folder. Right-click on App_Data...