开发者

Generate proxy classes not used by WebMethod

I have sortof the opposite of this question: 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.)


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.


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜