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:
Change the filename from
IService1.cs
toIProductService.cs
. This will also change the interface name from all related places inside the project.Change the first operation contract definition. Consider the following line:
string GetData(int value);
Change it to this line:
Product GetProduct(int id);
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...