0

We are storing keys and configuration values (which do not change very frequently) in both web.config files and database too. However, its hard to maintain, lots of problems occur in this method.

I want to fix these issues. most of them are fixed, some of them are dependent upon configuration modes.

Can we store these keys in resx files and use them like globalization? I mean, like in MVC, we can use seperate views according to even custom conditions (like browser and any other things).

Using OOP knowledge, it might be (such as we can create a resource factory and serve resources according to active configuration mode). But without the effort and sacrificing design-time support, is there any other way?

Oğuzhan Kahyaoğlu
  • 1,727
  • 2
  • 15
  • 20

1 Answers1

1

Resx files are for resources like strings and images etc. It would be cleaner if could have configuration stored in the DB only and have a Configuration Service return the configuration per environment/config mode.The web.config will just point to the right Configuration service.

amar_kar
  • 73
  • 6
  • yes you are right, they are for storing these types of things. But when we store these configuration strings in db and access them via a service/factory via keys, we sacrifice strong type access of c# localization service (such as GlobalResources.BlaBla.MyKey). But these seems to be the medium scenario imo too. – Oğuzhan Kahyaoğlu Aug 26 '17 at 11:28
  • For access, the service should preferably read the data from the DB using a ORM like Dapper etc and serialized into JSON/XML which can be de-serialized into a first class object on the client/consumer. – amar_kar Aug 29 '17 at 22:02
  • you didnt get the clue there; we do not want to sacrifice power of strongly-typed access to these resources. anyway i found some libraries which generate resx files dynamically at runtime based on databases. i will make a decision among them... – Oğuzhan Kahyaoğlu Aug 30 '17 at 13:22