310Microsoft Visual Studio 2010: A Beginner’s Guide
The methods of the CustomerService class in Listing
the ICustomerService interface, so the code in Listing
the CustomerService class. If using C#, add the code to each method. If using VB, which doesn’t have the same interface refactoring support as C#, add all methods and code to the CustomerService class as specified in Listing
Listing 11-5 A WCF service implementation
C#:
using System;
using System.Collections.Generic; using System.Linq;
using System.Runtime.Serialization; using System.ServiceModel;
using System.Text;
namespace WcfDemoCS
{
public class CustomerService : ICustomerService
{
public Customer GetCustomer(int custID)
{
var ctx = new MyShopDataContext();
var customer =
(from cust in ctx.Customers where cust.CustomerID == custID select cust)
.SingleOrDefault();