0

I am in search of a better solution for keeping some constants, which are global and independent of build deployment. We may have several constant strings, with its vales might have been changed frequently.

If I use resource file, it needs deployment on each and every change. Getting it from DB or XML may be a bad choice or costly. I am looking for some solution apart from AppSettings. I am using Web API and JQuery, it might be needed in both the places. Any thoughts?. Appreciate your time investment and help. Thanks

Unais.N.I
  • 61
  • 3

1 Answers1

1

There can be only these below options to store changing string contants-

  • Database
  • File System (XML/JSON Formats)
  • WebConfig (AppSettings)
  • Resources

If constants are large in number then AppSettings would not be a good choice, Any change in the Resource file will cause the application to build again. So keeping such records in XML would be a better choice.

You can create a XML file for keeping constants and an API method using WebAPI to update the string constants and use those string constants all over your application.

See this answer for reading and writing a XML file - https://stackoverflow.com/a/3736648/3748701

Linq to XML - https://stackoverflow.com/a/670569/3748701

Another detailed XML read/write usage- http://www.c-sharpcorner.com/UploadFile/mahesh/ReadWriteXMLTutMellli2111282005041517AM/ReadWriteXMLTutMellli21.aspx

Community
  • 1
  • 1
Manik Arora
  • 4,702
  • 1
  • 25
  • 48