WCF Multiple OperationContracts for one Service

时间:2016-07-11 21:53:53

标签: wcf

In WCF is this legal?

I would like to do two services with one svc file. How do I configure my endpoints in the client?

[ServiceContract]
public interface IAuditLog
{
    [OperationContract]
    bool Log(int AuditTypeID, string UserName, string ImpersonatingForUserName, string Action);

    [OperationContract]
    string PageLog(int PageActionID, string UserName, string ItemName, string Value, string Operation);
}

Then in my svc file

public class AuditLog : IAuditLog
{
     public bool Log(int AuditTypeID, string UserName, string ImpersonatingForUserName, string Action)
     {
        .....
     }

     public string PageLog(int PageActionID, string UserName, string ItemName, string Value, string Operation)
     {
         .....
     }
}

1 个答案:

答案 0 :(得分:1)

是的,每service contract可以有多个OperationContracts。

  

服务公开了许多操作。在Windows通信中   基金会(WCF)应用程序

来自MSDN - 一个带有定义合同和接口实现的接口的示例。

class Parent: UIView {
    func doSomething() { print("Hello") }
}

class Child: Parent {
    override func doSomething() { print("Hello world!") }
}