WCF接口和方法 [英] WCF Interface and methods

查看:124
本文介绍了WCF接口和方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用WCF服务创建ac #Project,我使用3层体系结构。

I'm creating a c# Project with WCF Service, I use 3-Tiers Architecture.

我创建我的WCF服务如下:

I create my WCF Service as below :

namespace MyApp.WCFService
{
    [ServiceContract]
    public interface IServiceWCF
    {
        [OperationContract]
        string SayHello(string who)
    }
}

namespace MyApp.WCFService
{
    public class ServiceWCF : IServiceWCF
    {
        public string SayHello(string who)
        {
            return "Hello" + who + "from Web Service";
        }
    }
}

这很有效,但是我的解决方案我有另一个方法项目。

This works great, but in my solution I had another project with methods.

我想知道是否可以让我的IServiceWCF接口从其他项目而不是WCF中实现我的方法。
或者我应该复制我的方法并将其粘贴到WCFService类中?

I would like to know if it's possible to make my IServiceWCF Interface implement my methods from an other project, not in the WCF. Or should I copy my methods and paste it in the WCFService class ?

抱歉我的英文不好,我不是母语人士!

Sorry for my bad english, I'm not a native speaker!

感谢您的帮助

推荐答案


可能让我的IServiceWCF接口从另一个项目实现我的方法,而不是在WCF中

possible to make my IServiceWCF Interface implement my methods from an other project, not in the WCF

当然。添加对WCF项目中其他项目的引用,让其他项目中的类实现WCF接口并配置您的服务以使用OtherProject.Namespace.Class作为服务。

Of course. Add a reference to the other project in the WCF project, let the class in the other project implement the WCF interface and configure your service to use the OtherProject.Namespace.Class as service.

这篇关于WCF接口和方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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