如何从另一个访问一个服务合同 [英] How to access one service contract from another

查看:74
本文介绍了如何从另一个访问一个服务合同的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

ref:http://social.msdn.microsoft.com/Forums/en-US/wcf/thread/fcb07403-97d9-4b8d-b9b5-2a00e4299137

我创建了WCF服务


ref :http://social.msdn.microsoft.com/Forums/en-US/wcf/thread/fcb07403-97d9-4b8d-b9b5-2a00e4299137

I have created a WCF service


namespace MyNamespace
{
[ServiceContract(
Name = "IService",
SessionMode = SessionMode.Required)]

public interface IService : IService1,IService2
{

}

}


namespace MyNamespace
{
[ServiceContract(
Name = "IService1",
SessionMode = SessionMode.Required)]
public interface IService1
{
[OperationContract(IsOneWay = true)]
void add(int int);
}
}

namespace MyNamespace
{
[ServiceContract(
Name = "IService2",
SessionMode = SessionMode.Required)]
public interface IService2
{
[OperationContract(IsOneWay = true)]
void calculate(int int);
}
}


现在,在IService2(即Service2Impl)的实现中,我需要访问Service1Impl.

这可能吗?

Now , in the Implementation of  IService2 (ie. Service2Impl) I need access to Service1Impl.

Is this possible? how ?

推荐答案


我想你可以做到,就像其他调用其他类.实例化它,然后调用方法想要.

Hi,
  I guess you can do it,Just like other call other classs.instance it ,then call the method you want.


这篇关于如何从另一个访问一个服务合同的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆