302Microsoft Visual Studio 2010: A Beginner’s Guide
The WCF Service Library starts with two files with default names of IService1.cs (IService1.vb for VB) and Service1.cs (Service1.vb for VB), which contain an interface and a class that implements that interface. If you need to brush up on interfaces, review Chapter 4 because an interface is an integral part of WCF development.
Specifying a Contract with WCF Interfaces
The IService1.cs (IService1.vb in VB) class in Figure
Examining the VS-Generated Contract
You really don’t want to work with an interface named IService1; it doesn’t mean anything. So, rename IService1.cs to ICustomerService.cs (IService1.vb to ICustomerService.vb for VB), because it will be configured to manage customer records. You’ll receive a message box for renaming the code, and you should respond affirmatively. When you open the ICustomerService.cs file, you’ll see the same code as Listing
Listing 11-1 A WCF service interface
using System;
using System.Collections.Generic; using System.Linq;
using System.Runtime.Serialization; using System.ServiceModel;
using System.Text; namespace WcfDemoCS