wsdl : Generate Proxy for the WebMethods but not t

2019-06-12 05:12发布

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!

标签: c# proxy wsdl asmx
2条回答
三岁会撩人
2楼-- · 2019-06-12 05:36

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.

查看更多
【Aperson】
3楼-- · 2019-06-12 05:49

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

查看更多
登录 后发表回答