Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Application Settings for C# App

Tags:

c#

oop

I have an app that has settings the user can pick before running the app. The settings are stored in a database. The entire app uses these settings. Right now, each class that uses the settings calls the database in its constructor to load the settings into a class. This seems odd to me because, the settings shouldn't change in the middle of running the app. So, how do you have your Application Settings called?? Do you use a static class or a singleton pattern instead of hitting the database each time to call the same settings??

like image 495
user204588 Avatar asked Jan 21 '23 14:01

user204588


1 Answers

Yes, I usually throw that kind of stuff in a static Application class, especially if there's no reason to query multiple times.

like image 85
Jarrett Meyer Avatar answered Feb 01 '23 08:02

Jarrett Meyer