How do I know how many queries on the Entity Framework database are executed for each incoming query?

I am running a C # 4.0 site that uses Entity Framework 4.0 to interact with a database. I want to find pages that force the Entity Framework to make the most calls in the database (since the more calls, the slower the page will be).

I would add some tools for the Entity Framework, actual users will manage the site for a while, and then analyze some kind of log to find out which pages generated the most calls to the database.

Is there any performance counter or other event that can be checked to find out when the database query was created by the Entity Framework?

+5
source share
4 answers

you can try the Entity Framework Profiler (its own website here ), although it is not a free product, it does have a 30-day free trial. And it is written, one of the smartest guys around

However, problems will be noted, such as choosing N + 1 and a warning about bad practices.

From the commercial:

Entity Framework Profiler - , , Entity Framework. , OR/M. . , ,

( ):

Profiler Framework Profiler . -, , . .

HibernatingRhinos.Profiler.Appender.dll , -. (Application_Start , Program.Main Windows / WPF), :

HibernatingRhinos.Profiler.Appender.EntityFramework.EntityFrameworkProfiler.Initialize();

, . ( ):

HibernatingRhinos.Profiler.Appender.EntityFramework.EntityFrameworkProfiler.InitializeOfflineProfiling(filename);

.

, , .

+1

It is best to use a profiler to count SQL calls, you can just use the built-in SQL profiler (although it is not included in SQL Express).

+1
source
0
source

All Articles