开发者

Initialize extending class - Design question

开发者 https://www.devze.com 2023-04-05 09:33 出处:网络
I\'m running into a design problem in my C# application. I have a DAL which supplies data for several different customers from different databases. Until now these databases have 开发者_运维问答had th

I'm running into a design problem in my C# application. I have a DAL which supplies data for several different customers from different databases. Until now these databases have 开发者_运维问答had the same tables and field names, but now i have one database which has different field names, because the customer wants the field names to be of locale language instead of english.

How do i solve this?

My current application achitecture is based on factories. So i have this:

BusinessFactory initialzes the DAL, so my first thought was to just extend the DAL and then override the function where the database field names needs to be changed and make a new function in the extending class. But when should i initialize this extending class?

I can't do it from my BusinessFactory because the DAL is depending on a Interface.

Please, also point me the other direction if I'm all wrong about extending the DAL as a solution to this problem.


I think you must be having a client -> db mapping in place based on which you decide that which db to connect to.

So you can introduce a pre processor layer to figure out the column names you need to get from database. So basically you will keep a per client config (and a default config) which you can use.


Simple solution would be to create Views with column names in the language your client wishes. This way you do not have to change your application.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号