I am working on MVC5 applications where I have a base controller which is inherited by every controller in my application.
I am using OnActionExecuting function of base controller to load and maintain menus from database.
As this function will be called every-time any controller inherit base controller so some times it has been called more than once.
Can I use/create any other function from base controller which will be called once when view is about to render.
Is there any better way to maintain menus for the same user as in such case no need to hit database on every page, TIA.
Good idea will be to use caching. For instance Cache Class where you can store objects and retrieve them by key.
It is an example. It can be done much better, but for an idea it is enough, I guess.