I have some domain logic exposed via WCF services. Rather than explicitly writing WCF proxy calls, etc. in my MVC web application, I've wrapped the WCF service references up into their own project - MyProject.BizLogic.Endpoint - and then added a reference to this project to my web app.
This is great for keeping the controller code clean and readable - Endpoint exposes an ICrmSystem interface with nicely abstracted methods like RetrieveCustomerDetails(int customerId), and then within the endpoint class that's wrapped up into a CustomerQuery DTO and fired off at a remote CustomerQueryHandler service. For isolation testing, you just mock ICrmSystem and test the controller methods against the mocked implementation.
Thing is - WCF needs lots of cryptic and delicate configuration, and at the moment I have to have the whole system.serviceModel bindings and client configurations in my web app's web.config file.
Is there a cleaner way of managing this configuration - preferably as part of the Endpoint abstraction module so the web developers don't even need to know that WCF is going on behind the scenes? Can I put a reference to the Endpoint's config file into my web app somehow? Or manage WCF configuration programatically instead of declaratively?
Thanks,
Dylan