WCF Service Reference generates its own contract interface, won't reuse mine

后端 未结 4 1562
离开以前
离开以前 2020-12-02 15:31

My first question so hope it is suitable:

Shared interface assembly - I have a \'shared\' assembly which has an interface, let\'s call it IDocRepository

4条回答
  •  死守一世寂寞
    2020-12-02 16:15

    There is another good option, if you want to continue to use the proxy generator for it's limited-but-somewhat-useful functionality... Use a partial class:

    namespace 
    {
        public partial class MyClient : .IServiceContract
        {
        }
    }
    

    Ensure that the proxy is generating code the same way your Service Contract is defining it, ie, if it's using 'List', use that option in Configure Service References as well. In other words, make sure your generated Service Interface is exactly equal to your real Service Interface and the above code should work, and to update the reference you use right-click instead of writing code.

提交回复
热议问题