请原谅我这个天真的问题。 我在客户端创建了一个WCF服务的服务引用,在示例中我提到他们已经创建了一个代理来创建WCF类的对象,我想了解" ServiceCalculateCostClient"来自。以下是客户电话 -
CalculateCost.IServiceCalculateCost ICost = new CalculateCost.ServiceCalculateCostClient();
CalculateCost.ProductData objProductData = new CalculateCost.ProductData();
objProductData.ProductName = "Shirts";
objProductData.ProductQuantity = 4;
objProductData.PerProductCost = 200;
Response.Write(ICost.getTotalCost(objProductData));
这是SVC代码
public class ServiceCalculateCost : IServiceCalculateCost
{
string IServiceCalculateCost.getTotalCost(ProductData objProductData)
{
double totalCost = objProductData.PerProductCost * objProductData.ProductQuantity;
return "The total cost for product " + objProductData.ProductName + " is " + totalCost.ToString();
}
}