J
Jeff S
I'm storing a list of widgets in a database. The list changes infrequently
(twice per week at most), and is relatively short (200 items at most, with
very little detail per item). A small subset of all possible widgets will be
displayed on a page (using VB.NET/code behind). I plan to populate a custom
collection/class with a list of all possible widgets. The class will include
a method that returns the required subset. Of course the logic will have to
hit the database in order to populate a custom collection. Because I want to
minimize the number of hits on the database, and because the class will hold
relatively little data, and because and the data is identical for all users,
I think it makes sense to maintain it in the Application state.
My questions:
1. When/where should I instantiate and initialize the custom
collection/class? It seems that if I do it in the page_load event of
Default.aspx, that I'd hit the database too much (every time a user opens
the application). But, if not during that event, then when should it be
initialized?
2. When the list of widgets gets updated in the database (twice per week or
so), the custom collection/class would need to be refreshed in order to
include the changes made in the database. What would be a good stragegy for
keeping the custom collection/class synchronized with the database?
Thanks in advance.
Jeff
(twice per week at most), and is relatively short (200 items at most, with
very little detail per item). A small subset of all possible widgets will be
displayed on a page (using VB.NET/code behind). I plan to populate a custom
collection/class with a list of all possible widgets. The class will include
a method that returns the required subset. Of course the logic will have to
hit the database in order to populate a custom collection. Because I want to
minimize the number of hits on the database, and because the class will hold
relatively little data, and because and the data is identical for all users,
I think it makes sense to maintain it in the Application state.
My questions:
1. When/where should I instantiate and initialize the custom
collection/class? It seems that if I do it in the page_load event of
Default.aspx, that I'd hit the database too much (every time a user opens
the application). But, if not during that event, then when should it be
initialized?
2. When the list of widgets gets updated in the database (twice per week or
so), the custom collection/class would need to be refreshed in order to
include the changes made in the database. What would be a good stragegy for
keeping the custom collection/class synchronized with the database?
Thanks in advance.
Jeff