wsdl : Generate Proxy for the WebMethods but not t

2019-06-12 05:32发布

问题:

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!

回答1:

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.



回答2:

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



标签: c# proxy wsdl asmx