O'Reilly logo

WCF Multi-layer Services Development with Entity Framework Fourth Edition by Mike Liu

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Creating the RESTful service

Now we have the solution ready and have hosted the service in IIS. Next, we will modify the existing NorthwindService to be RESTful. We will modify the service contracts, service implementation, and web config file.

Defining RESTful service contracts

In the existing NorthwindService, we have defined two operations for the service, GetProduct and UpdateProduct. To make them RESTful, we need to change their definitions using the following steps:

  1. Add a reference of System.ServiceModel.Web to the service project, NorthwindService.
  2. Open the IProductService.cs file in the project.
  3. Add a using statement:
    using System.ServiceModel.Web;
  4. Add the following line of code before the GetProduct method:
    [WebGet (UriTemplate = "Product/{id}" ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required