移动WCF合约以一个单独的DLL [英] Moving WCF contracts to a separate dll
问题描述
我想移动WCF合约接口第三DLL,并开始从客户端占用他们的时候,我的手产生的代理。
I want to move WCF contracts interfaces to third DLL and start consuming them from clients when I am generating proxy by hand.
执行DLL中的这些接口都具有 [的ServiceContract]
属性,当我使用它们从客户端生成一个代理?
Do those interfaces in the DLL have to have the [ServiceContract]
attribute when I consume them from the client to generate a proxy ?
任何知道什么是最好的命名的DLL,将只有合同和DTO的客户端和服务器之间共享。
Any idea what is the best naming for Dll that will have only contracts and the DTOs to share between client and the server.
推荐答案
这是非常普遍的做法是WCF数据服务合同分开组装。在我的previous项目中,我们使用像 Company.OurProject.Contracts.dll
命名。
我认为,产生与重用现有的类,你应该把你的接口服务合同(标有 [ServiceContractAttribute的]
)和相应的数据合约,该程序集的代理。我会避免把服务有实际的执行情况。
It is very common practice to put WCF data and service contract to separate assembly. In my previous project we used naming like Company.OurProject.Contracts.dll
.
I think that to generate proxy with reusing existing classes you should put your interfaces for service contracts (those marked with [ServiceContractAttribute]
) and corresponding data contracts to that assembly. I would avoid putting there actual implementation of the services.
下面是更深入地了解,当重用类型的引用的程序集所选内容可以重复使用的SO另一个伟大的回答:<一href="http://stackoverflow.com/questions/3119329/wcf-service-reference-generates-its-own-contract-interface-wont-reuse-mine">WCF服务参考产生自己的合同的接口,不会再用我的!
Here is another great answer on SO with more insight into what can be reused when "Reuse types in referenced assemblies" is selected: WCF Service Reference generates its own contract interface, won't reuse mine!
这篇关于移动WCF合约以一个单独的DLL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!