WCF 返回超过 2 个服务的类型
我有一个 WCF 服务应用程序。我有 2 份不同的合同(服务)。我这样做是因为通过让他们提供一项大型服务,将会有 80 - 90 个运营合同。
所以我把它们分成了2个服务。这两个服务共享一些业务对象(来自 DAAB 层的数据契约)。这两项服务均由一个应用程序使用。
我在客户端有一个不明确的类型,因为即使它们在服务端是一种复杂的数据类型,但它们在客户端被认为是两种不同的数据类型。
有什么方法可以让我在客户端说两者是同一类吗?
I have a WCF Service Application. I have 2 different contracts(services). I did this because by having them one big service, there will be 80 - 90 Operation contracts.
So I divided them into 2 services. Both these services share some Business objects (data contracts from DAAB layer). Both the services are used by one app.
I have a ambiguous types on the client side, because even though they are one complex datatype on the service side, they are considered 2 different data types on the client side.
Is there way where I can say both are of the same kind on the client side?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我在一个项目中遇到了类似的问题...我们只是直接调用 svcutil.exe 来生成客户端代理。诀窍是同时传入两个服务,以便它可以重用这些类型。
编辑:本文似乎解决了您遇到的问题:
http:// /blog.jasonconnery.ie/net-reusing-types-across-multiple-webservices
I ran into a similar problem on a project... We just called svcutil.exe directly to generate our client proxies. The trick is to pass in both services at the same time so that it can re-use the types.
EDIT: This article appears to solve the problem you're having:
http://blog.jasonconnery.ie/net-reusing-types-across-multiple-webservices