Avatar of mentor360
Flag for Colombia asked on

Broker Class C Sharp with two sources.

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?


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?


Avatar of undefined
Last Comment

8/22/2022 - Mon

Reflection would be my last option.

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
Your help has saved me hundreds of hours of internet surfing.