wsdl :为 WebMethods 生成代理,但不为其他依赖类生成代理

发布于 2024-08-14 15:20:35 字数 586 浏览 1 评论 0原文

假设我有一个带有 WebMethod AddUser(User userObject) 的 WebService SettingsWebService。
User 类位于 SettingsWebService 解决方案中。
当我为 SettingsWebService 生成代理时,它会为 asmx 创建一个类,其中包含 AddUser webmethod。
它还为 User 类生成一个类。

客户端现在使用

Proxy.AddUser(Proxy.User 用户)

接口。

有没有办法告诉 wsdl 不要为 User 类生成类,以便保留签名:

Proxy.AddUser(SettingsWebService.User) 用户)

客户端将拥有对代理和 SettingsWebSerice dll 的引用。


现在,我必须手动删除代理中 User 部分类的代码,并添加对 WebSettings dll 的 usings 引用。



非常感谢!

Say, I have a WebService SettingsWebService with a WebMethod AddUser(User userObject).

The User class is in the SettingsWebService solution.

When i generate a proxy for the SettingsWebService it creates a class for asmx which contains the AddUser webmethod.

It also generates a class for the User class.

The client now uses

Proxy.AddUser(Proxy.User user)

interface.

Is there any way to tell wsdl to not generate a class for the User class, so that the signature remains :

Proxy.AddUser(SettingsWebService.User
user)

The Client will have a reference to the proxy and the SettingsWebSerice dlls.

Right now I am having to manually remove the code for the User partial class in the proxy and add a usings reference to the WebSettings dll.

Many thanks in advance!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(2

别在捏我脸啦 2024-08-21 15:20:35

您需要添加 schemaInmporterExtensions在生成代理之前将元素添加到 machine.config 中。将此点指向包含 SettingsWebservice.User 类的程序集,并且不会生成代理。

You'll need to add a schemaInmporterExtensions element to your machine.config before generating the proxy. Make this point to the assembly which contains your SettingsWebservice.User class and a proxy will not be generated.

无尽的现实 2024-08-21 15:20:35

为什么需要这样做?如果它是 Web 服务,则无需将 SettingsWebService.dll 与代码一起分发

Why you need to do this? If it is a web service you don't need to distribute the SettingsWebService.dll with your code

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文