views:

57

answers:

3

I have a serializable POCO called DataUnification.ClientData.ClientInfo in a .NET class library project A.

It's used in a parameter for a web service defined in project B:

public XmlDocument CreateNewClient(ClientInfo ci, string system)

I now wish to call this web method from project C and use the original DataUnification.ClientData.ClientInfo type in the parameter. However due to the generated proxy class it has now become a different type: WebServices.ClientDataUnification.DataUnificationWebService.ClientInfo.

As far as .NET is concerned these are not the same types.

How can I get around this?

A: 

My first suggestion would be to use hand-written proxies instead of generated proxies, so you have full control over which types are used.

My second suggestion would be to use a tool like the Web Services Factory, which has an option to let you reuse existing classes when it generates code (if the classes are appropriate.)

Toby
I edited the generated proxy to use the POCO and it all worked fine. Didn't know about Web Services Factory - looks interesting.
Alex Angas
A: 

You could use automapper http://automapper.codeplex.com/ to create a new DataUnification.ClientData.ClientInfo from the WebServices.ClientDataUnification.DataUnificationWebService.ClientInfo instance.

Raj Kaimal
A: 

You can 'show all files' and copy the contents of the generated reference.cs into a new file, then delete the generated proxy and all of its dependent files.

Now, in your new reference.cs, delete the generated dto classes and update all references.

That is the short ugly way.

Sky Sanders