static - Queries count for page in asp.net mvc -


I want to know how many queries are executed while requesting a page in asp.net mvc. Difficulties in page logic: Yoga queries are executed in main controller action, but others - widget controller functions, which are called in the HTML page.

I wrote the base class for all the controllers in which I called the function to increase the query. Query equivalent - static variable works well when loading the page, calculate all the questions But when I request a second page, my static counter does not reset, what should I do?

If possible, avoid using a fixed variable as an example variable on the base controller as easily as possible If all the methods have shared the same controller example. I believe that you are not using new controllers to execute other actions.

Edit : After thinking about it, a simple static variable will not work because it will be shared in all requests to identify the request by some unique ID Must choose some kind of dictionary. Probably based on the combination of host address and a timestamp when the request is initiated. Perhaps using application cache will work, so it will be available from everywhere and automatically it will be cleaned when you do. It is only going to be more complex as you consider all possible ways that many threads can communicate. Again, I would say that trying to use any frequency variable could be the best way to handle it.


Comments

Popular posts from this blog

oracle - The fastest way to check if some records in a database table? -

php - multilevel menu with multilevel array -

jQuery UI: Datepicker month format -