Hi,
I have this web application. And created a Singleton class in the App_Code folder, so it is accesible through the entire application. The web app, requiere some data from a SQL Server, describirng all the countries, their states and its capitals. So this is information that barely have to change (maybe some nuts drop an atomic bomb over a country and it just dissapear, and then the DB will have to change). In a common approach, the geographic data will be cached or stored in an Application variable. But with te singleton I have mentioned before, I just had to include in it a DataSet with this info when the application starts. Then the geographic data remain accessible to all the app, in a fast way, and without having to visit the dataserver again. Everything worked fine.
Nevertheless, I think this is too wonderful to be real! And I have never seen an article talking about this approaching for application state managment. What do you think about this? Have you ever seen or made anything like this? Do you think this approach have spetial side effects? Will the described data be too much load for the server memory when it will be in production serving like a thousand of clients?
I'll be glad hearing your opinion.
PD.: I didn't use Cache, because the data will never expire. And I didn't use application variables, because, I don't like making castings (boxing and unboxing) everytime I need to query the data: This is: if I want to read the dataset I have to perform something like this: ((DataSet)Application["myData"].Tables.Count) but with the singleton: ContentManager.myData.Tables.Count. As you can see the acces is more natural, and I think there will be a gain in performance, since no casting is made.