What you need to do? Cache the data? But your date is dynamic and can be modified by the user. So you need to implement some mechanism to reset your cache? Another bicycle...
Acumatica Framework can address this issue with Database Slots Technology:
- Framework stores your data in the HttpContext in special dictionaries.
- Framework automatically calls Prefetch method on first access to cached data.
- Framework automatically monitors dependant tables and will reset cache when someone has updated it.
- Framework automatically handles cluster mode.
- Access to the cached values is significantly faster.
lots are subscribed to database changes and with be automatically reset with any update/insert/delete operation to your table, so you don't need to care about changes.
On the first request system will automatically call your method to fetch data from the database, so you don't need to care about it too.
After defining this class you can use it in your code like this:
var ret = ValuesCacheClass.Values;
This is very nice example if you want to implement drop-down control with dynamic data. In this case you can get data from the database slot on CahceAttaced event and fill Values and Labels appropriately.