How do I call WCF services dynamically from a .Net client application?
Posted on 2012-09-06
I've got a WCF Design/Architecture question.
I've got a WPF based front end which will talk with 1 or more WCF services on the backend.
The Services are designed so that their method signatures will all be the same.
So the the basic architecture looks like this:
WPF Client App
/ | \
WCF1 WCF2 WCF3 ... ... WCFN
Ultimately, I'd like to be able to to connect to these services dynamically.
So at runtime I've got 1 to N services I can connect to. I want to determine at
runtime which service endpoint to connect to, based on some user contextual data.
Remember that my method signatures will be the same across all services.
I will be making the same calls. I don't want to have to distinguish between services
on my user panels code behind.
This method will allow us to extend the service offerings dynamically without affecting the client (WPF based) installation.
What's the best way to achieve this?
If there is some trickery involved, is it best to handle that in a WCF service that acts as a federation layer (of sorts?)
Can this method be extended for use by front ends created with other technologies (ASP .Net, MVC, Mobile, and so on)?
This is a key point to resolve as we are architecting the solution.