2013-03-28 97 views
1

我是新来的WCF,不知道什么是错的,我得到以下错误:WCF接口没有实现

WcfServiceLibrary.ReportServiceCO' does not implement interface member 'WcfServiceLibrary.IReport.GetAllOrdersForCustomer(int)'

接口:

[ServiceContract] 
interface IReport 
{ 
    // [OperationContract] 
    // List<ModelData> GetAllCustomer(); 
    [OperationContract] 
    List<ORDER> GetAllOrdersForCustomer(int _customerid); 
} 

类:

class ReportServiceCO : IReport 
{ 

    public List<ORDER> GetAllORDERsForCustomer(int _customerid) 
    { 
     List<ORDER> orders = new List<ORDER>(); 
     TestEntities ent = new TestEntities(); 
     var orders3 = from x in ent.ORDERs 
         where x.CUSTOMERID == _customerid 
         select new { x.ORDERID, x.DATA, x.CUSTOMERID, x.VALOARE }; 
     foreach (var i in orders3) 
     { 
      ORDER o = new ORDER(); 
      o.ORDERID = i.ORDERID; 
      o.CUSTOMERID = i.ORDERID; 
      o.DATA = i.DATA; 
      o.CUSTOMERID = i.CUSTOMERID; 
      o.VALOARE = i.VALOARE; 
      orders.Add(o); 
     } 
     return orders; 
    } 
} 

回答

5

方法名称区分大小写:

interface是它声明为:

GetAllOrdersForCustomer 

然而,实现被定义为:

GetAllORDERsForCustomer 

它需要:

public List<ORDER> GetAllOrdersForCustomer(int _customerid) 
{ 

} 
+0

没有看到它!谢谢! – 2013-03-28 11:09:16

1

重命名GetAllORDERsForCustomer到GetAllOrdersForCustomer。