How to pass Interface type to ChannelFactory<> without hardcoding the name
Hi,
I calling a WCF Service using reflections . Where I'm creating a Proxy by using ChannelFactory ,binding and endpoint address.
Let us think that My ServiceContract Name is ISeravice1.
I'm creating a Proxy and calling a specific method in this way:
using (ChannelFactory<T> cf = new ChannelFactory<T>(binding, uri))
{
object oProxy = cf.CreateChannel();
Type oType = oProxy.GetType();
MethodInfo oMeth = oType.GetMethod(method);
oMeth.Invoke(oProxy, args);
}
In the above code I need to pass <T> as my ServiceContact that is IService1.
If I have many Service Contracts then I need to specify all , so I need to remove hardcoding of name of Service Contract.
Regards,
Ramana