EverythingEthical
EverythingEthical

Reputation: 434

How to calculate number of database queries in a MVC project?

We calculate the no. of db queries in ASP.NET application by searching for ".fill(" or ".execute" and then looking for the query/stored proc.

What is the way we can find the no. of db queries in an MVC application?

This is as part of application analysis...

Upvotes: 1

Views: 92

Answers (2)

variable
variable

Reputation: 9664

Search for "DbContext" in the entire solution.

This will take you to the controller.

Within the Method inheriting from dbcontext, you get name of all the DbSets.

Then you can search for each "DbSetName" which will lead you to the LINQ query!

Upvotes: 1

šljaker
šljaker

Reputation: 7374

I don't know much about your application but I would try to do the following:

  • use SQL profiler to see which queries are executed
  • create a web crawler to get a list of all links in the application
  • click on each link (by hand or from the code) and analyze results from SQL Profiler

Upvotes: 1

Related Questions