Book Image

WCF Multi-layer Services Development with Entity Framework - Fourth Edition

By : Mike Liu
Book Image

WCF Multi-layer Services Development with Entity Framework - Fourth Edition

By: Mike Liu

Overview of this book

Table of Contents (20 chapters)
WCF Multi-layer Services Development with Entity Framework Fourth Edition
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
2
Hosting the HelloWorld WCF Service
Index

Creating the service interface layer


In the previous section, we have created a WCF project using the WCF Service Library template. In this section, we will create the service interface layer contracts.

As two sample files have already been created for us, we will try to reuse them as much as possible. Then, we will start customizing these two files to create the service contracts.

Creating service interfaces

To create the service interfaces, we need to do the following to the IService1.cs file:

  1. Change the filename from IService1.cs to IProductService.cs. This will also change the interface name from all related places inside the project.

  2. Change the first operation contract definition. Consider the following line:

    string GetData(int value);

    Change it to this line:

    Product GetProduct(int id);
  3. Change the second operation contract definition. Refer to the following line:

    CompositeType GetDataUsingDataContract(CompositeType composite);

    Change it to this line:

    bool UpdateProduct(Product product, ref string...