Broker Class C Sharp with two sources.

mentor360
mentor360 used Ask the Experts™
on
I have my data distributed between a local database exposed by a class with all the logic and a WCF Service.
Some methods (selects) should be called to the local database  due performance, but the more complex ones should be called to the WCF proxy.
Is there a pattern implemented on C# that doesn't involve rewriting every method like a facade to decide wheather to go WCF or Local DB?

Example

My WCF Proxy has the method

IEnumerable<LanguageDTO> getLanguages();

Open in new window


And I have a class conected to the local database that also has the method

IEnumerable<LanguageDTO> getLanguages();

Open in new window


I am building a class called Broker that should expose also the method getLanguages() to the GUI and should decide which getLanguages to call (WCF or Database)

Is there a way of building that class without creating every method again?

Thanks
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®

Author

Commented:
Reflection would be my last option.
The solution I found was making that the database controller class inherit from the WCF Proxy and I am only overriding the methods that should go to the local database instead of the WCF.
That way I dont have to make a facade, I just have to call the database controller and if it doesnt have the method implemented, the WCF is called.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial