MiniProfiler Entity Framework Core how to exclude calls to Open/Close?

303 Views Asked by At

In ASP.Net Core 2 web site we are using the latest (4-alpha9) MiniProfiler to see the SQL being generated.

Beside generated SQL, I also see a lot of calls to Connection Close()/Connection Open():

enter image description here

They are fast and logging them seems useless to me. Can I filter them out? Some of them can be filtered out using options.ExcludedMethods.Add("ConnectionOpening"); but not all of them. Also, these calls seem to ignore options.TrivialDurationThresholdMilliseconds = 3; setting, that I also tried.

Are there any other options?

1

There are 1 best solutions below

0
On BEST ANSWER

These timings cannot be turned off in the version you're using. We added the timings because they help show getting a connection from the pool, delays there, etc. But, I totally see how they can be noisy for a ton of use cases and agree this would be annoying.

I've just added an option to control this in MiniProfiler. If you grab latest from MyGet (the build should finish shortly) or NuGet later this week, you'll be able to use:

options.TrackConnectionOpenClose = false;