TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Ramana
NA
25
59.2k
How to pass Interface type to ChannelFactory<> without hardcoding the name
May 24 2011 6:53 AM
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
Reply
Answers (
1
)
Getting UnAuthorizedAccessException while deleting a temp dll
Material for Automation and Manual Testing using VS 2010 Ultimate