Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Windows Phone 7.5 Data Cookbook

You're reading from   Windows Phone 7.5 Data Cookbook Over 30 recipes for storing, managing, and manipulating data in Windows Phone 7.5 Mango applications.

Arrow left icon
Product type Paperback
Published in Oct 2011
Publisher Packt
ISBN-13 9781849691222
Length 224 pages
Edition 1st Edition
Languages
Arrow right icon
Author (1):
Arrow left icon
Ramesh Thalli Ramesh Thalli
Author Profile Icon Ramesh Thalli
Ramesh Thalli
Arrow right icon
View More author details
Toc

Building a service layer using WCF


In the last recipe, we learned how to call a simple WCF service from the client application. In this recipe let's create a MyTasks Service.

Getting ready

Create a new project using the WCF service template and follow the same steps as in the recipe Writing and consuming a simple web service to create the service.

How to do it...

In this recipe, we will first create the WCF service and then build the Data Contract and Service Contract. In the Data Contract, we will add all the Data members; in the Service Contract we will return a collection class. Once the service is built successfully, we create the Phone Client application to call the service when searching for a task name.

  1. Right-click on the project and click on Add new item. Select the WCF service template and name it MyTaskService.svc.

  2. Open the IMyTaskService.cs file and add the following code for class MyTask and IMyTaskService:

    namespace Recipe2_MyTasksService
    {
      [DataContract]
      public class MyTask...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image