WCF 返回超过 2 个服务的类型

发布于 2024-12-04 18:35:03 字数 244 浏览 1 评论 0原文

我有一个 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

素衣风尘叹 2024-12-11 18:35:03

我在一个项目中遇到了类似的问题...我们只是直接调用 svcutil.exe 来生成客户端代理。诀窍是同时传入两个服务,以便它可以重用这些类型。

编辑:本文似乎解决了您遇到的问题:

http:// /blog.jasonconnery.ie/net-reusing-types-across-multiple-webservices

svcutil http://localhost/Service1.asmx http://localhost/Service2.asmx 
/out:api.cs /namespace:*,SomeNamespace.API

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

svcutil http://localhost/Service1.asmx http://localhost/Service2.asmx 
/out:api.cs /namespace:*,SomeNamespace.API
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文