Reuse types in current assembly for WCF Proxies

后端 未结 3 991
半阙折子戏
半阙折子戏 2020-12-30 08:15

VS WCF integration has nice option \"Reuse types in refrenced assemblies\". The problem is that I need the same but for the current assembly. Some of the types are already d

3条回答
  •  一个人的身影
    2020-12-30 08:42

    If I understand what you want to do, then it's an scenario I commonly run into, and well, WCF does have a decent answer to: Just don't use SvcUtil / WS Service Reference wizards.

    If you have most of the contract classes already defined in your client side (be that because you have a shared assembly or because you have equivalent classes defined on your project), you might as well just go to the next step and either import the complete service contract in code form or simply redefine it on the client side.

    There's nothing that forces you to use svcutil and friends, just define your interface and either use the channel model directly (i.e. ChannelFactory and friends) or, if you prefer to use proxy classes, just create your own ClientBase-derived class. It's really very easy and it will save you trouble in the long run.

提交回复
热议问题