Coc*_*dan 1 .net c# linq wcf entity-framework
我是WCF的新手,不知道出了什么问题,我收到以下错误:
WcfServiceLibrary.ReportServiceCO'没有实现接口成员'WcfServiceLibrary.IReport.GetAllOrdersForCustomer(int)'
界面:
[ServiceContract]
interface IReport
{
// [OperationContract]
// List<ModelData> GetAllCustomer();
[OperationContract]
List<ORDER> GetAllOrdersForCustomer(int _customerid);
}
Run Code Online (Sandbox Code Playgroud)
班级:
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;
}
}
Run Code Online (Sandbox Code Playgroud)
方法名称区分大小写:
在interface它被声明为:
GetAllOrdersForCustomer
Run Code Online (Sandbox Code Playgroud)
然而,实施定义为:
GetAllORDERsForCustomer
Run Code Online (Sandbox Code Playgroud)
它需要是:
public List<ORDER> GetAllOrdersForCustomer(int _customerid)
{
}
Run Code Online (Sandbox Code Playgroud)