views:

139

answers:

3

I have a ASP.NET web application which has more than 100 pages. Each page is using some common values ( ex : current USDoller rate) .This can be changed at any time. Now I want to maintain this value in a single file so that i can change only her at any time to get it reflected throughtout the project.I dont want to store it in web config. I want to store it in some other place

Any thoughts ?

+1  A: 

Why not just make a static class and store the constants there. That way when you change it, everything will get the new values.

James Black
+5  A: 

Make a static class like this:

public static class MyConsts {
   public const string Prefix = "n-";
}

From anywhere in your project use:

MyConsts.Prefix

(Note: const is implicitly static)

John K
+4  A: 

My initial thoughts are one of the following:

  1. Store it in a database table and create a mechanism for editing the values
  2. Create a static class and store them there
lomaxx
Additional benefit to #1: you can make configuration changes at runtime, assuming you cache the settings for a finite period of time and then expire them.
Jon Sagara