tags:

views:

96

answers:

2

I have sortof the opposite of this question: http://stackoverflow.com/questions/1900701/wsdl-generate-proxy-for-the-webmethods-but-not-the-other-dependent-classes

How can one auto-generate other classes (utility classes) that are useful on the client side but are neither DataContracts nor ServiceContracts? In other words, wanting to extract specific classes instead of including entire DLL's.

Edit: Yes arbitrary classes. I think we will end up extracting those to a DLL other then the ones they're currently part of. Just wondering if there is a way using reflection or tool to copy out only specific classes from a source DLL to a destination DLL. "Proxy" is probably the wrong word because the methods wouldn't call WCF. Instead they would be normal classes, other than that they were copied from a source DLL. (The reason is, not wanting to share all of (decompilable) DLL's.)

A: 

You can't specify method implementaion thru WSDL. In order to accomplish what you are trying to do you would need to create a build script / marcro that creates and compiles a client library which has the proxy and your util methods.

HTH

unclepaul84
+1  A: 

If the source dll is something you control, then copying classes is really going to lead to problems down the road. The better approach would be to extract the shared classes to a "Shared" or "Interop" or "Common" dll that the client and server projects can both reference.

Doing this also helps separate data from logic since the shared/interop/common project shouldn't reference anything else and is very simply data containers.

Sam