English 中文(简体)
如何将全球合作框架的服务解决办法分成2个议会,1个合同,1个执行?
原标题:What are the advantages of splitting a WCF service solution into 2 assemblies, 1 for the contracts and 1 for the implementation?

为什么这种有利之处? 我能从这一分裂中得益吗? 感谢。

最佳回答

显而易见的好处是,你可以向客户分享服务合同文件。 如果在客户和服务器之间共享共同事务合同,客户可使用<代码>的服务。 ChannelFactory category.

ChannelFactory<IHelloWorld> channel = new ChannelFactory<IHelloWorld>("tcp"); 

(不同方式的WCF服务可由客户消费)。 (

问题回答

一般来说(并非特别针对全球合作框架的服务),从设计角度来说,这种做法被认为是良好做法,目的是把你的接口与执行工作分开。

然而,由于妇女论坛的服务,你必须谨慎从事: 如果接口项目包括使用服务方法的物体的接口,那么,WCF服务接口不应成为接口项目的一部分,而应在执行项目中加以界定。 原因是,由于接口类型不能按通用方式进行序列化,因此,WCF服务业务不应在其方法签名中使用接口类型。 它们应当使用执行类型,因此应当成为执行项目的一部分,因为否则,你需要从您的接口项目中添加一个参考内容。 这将缺乏设计,使接口与执行工作的分离无用。





相关问题
Manually implementing high performance algorithms in .NET

As a learning experience I recently tried implementing Quicksort with 3 way partitioning in C#. Apart from needing to add an extra range check on the left/right variables before the recursive call, ...

Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

How do I compare two decimals to 10 decimal places?

I m using decimal type (.net), and I want to see if two numbers are equal. But I only want to be accurate to 10 decimal places. For example take these three numbers. I want them all to be equal. 0....

Exception practices when creating a SynchronizationContext?

I m creating an STA version of the SynchronizationContext for use in Windows Workflow 4.0. I m wondering what to do about exceptions when Post-ing callbacks. The SynchronizationContext can be used ...

Show running instance in single instance application

I am building an application with C#. I managed to turn this into a single instance application by checking if the same process is already running. Process[] pname = Process.GetProcessesByName("...

How to combine DataTrigger and EventTrigger?

NOTE I have asked the related question (with an accepted answer): How to combine DataTrigger and Trigger? I think I need to combine an EventTrigger and a DataTrigger to achieve what I m after: when ...