开发者

WCF: How to create a method that will allow me to pass in and operate on an array of proxies with various types?

开发者 https://www.devze.com 2023-01-27 17:25 出处:网络
I was wondering if 开发者_JAVA技巧anyone can come up with a way that I can set the ClientCredentials of all my proxies using a single method call. For example, if I have:

I was wondering if 开发者_JAVA技巧anyone can come up with a way that I can set the ClientCredentials of all my proxies using a single method call. For example, if I have:

public class ServiceOneClient : ClientBase<IServiceOne>, IServiceOne
...

public class ServiceTwoClient : ClientBase<IServiceTwo>, IServiceTwo
...

how can I create a method that I can call like this?

SetProxyCredentials(serviceOneClient, serviceTwoClient);


not sure if its possible through an array since each proxy will have its own interface but maybe this would help :

public static void SetProxyCredential<T>(ClientBase<T> proxy) where T : class
{
  //set credential
}

you could then call SetProxyCrendential<IMyInterface>(proxy);

0

精彩评论

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