I need to have a few setting values which will be used throughout the application, and I want to modify these setting values sometime.
Is it possible to load data from a database into static class members? And also modify these values and store them back to the database.
public static class CurrencySettingsBO
{
public static int WindowPeriod { get; set; }
public static float MarkupRate { get; set; }
}
Like this static class, how can I store the modification to the database when I modify the value, and when I start the web application next time, the application will load the value from the database?
Thanks a lot if anyone can help me.
You can just create Table in your database that will store those settings and fetch them every time you need to reference those settings. If you still want to use static class you can change code in your set accessors of your properties, so every time value is assigned this will be also saved in DB