I'm working on a project that has a need for a buch of dropdowns that we are going to pull from the db.
So my thought is this: Make a singleton collection for each table that corresponds to a drop down, then I only have to hit the db one time - The options of the drop downs are, for all intents fairly static - that is to say, the can change occasionally, and restarting IIS when they do is acceptable.
Basically what I'm thinking is that when the the collection is first called, it's constructor goes out calls the db, and builds the collection. Then each time it's called, it will already be in memory. The methods for adding and deleting from the collection are private to the collection itself - I don't want anybody to be able to add or delete values from the collection once it's built.
My question is this: How concerned do I have to be about memory in this case? The lists I'm talking about arent' that big, and the objects in the lists don't have that many properties. Doing it this way seems MUCH more efficent that having each page build the objects each time - when you have a lot of visitors, even though the memory useage of the application when nobody is using it will be higher because those objects are still in memory.
Your thoughts and opinions please.
Thanks.
So my thought is this: Make a singleton collection for each table that corresponds to a drop down, then I only have to hit the db one time - The options of the drop downs are, for all intents fairly static - that is to say, the can change occasionally, and restarting IIS when they do is acceptable.
Basically what I'm thinking is that when the the collection is first called, it's constructor goes out calls the db, and builds the collection. Then each time it's called, it will already be in memory. The methods for adding and deleting from the collection are private to the collection itself - I don't want anybody to be able to add or delete values from the collection once it's built.
My question is this: How concerned do I have to be about memory in this case? The lists I'm talking about arent' that big, and the objects in the lists don't have that many properties. Doing it this way seems MUCH more efficent that having each page build the objects each time - when you have a lot of visitors, even though the memory useage of the application when nobody is using it will be higher because those objects are still in memory.
Your thoughts and opinions please.
Thanks.