The duration time for EF queries logged by DbContext.Database.Log
differs from the actual duration time that I can see in SQL Server Profiler.
In SQL Server Profile I see a line looking something like this
EventClass TextData Duration
RPC:Completed exec sp_executesql N'SELECT... 59473
But nowhere in the DbContext.Database.Log
s can I find a query with that duration time. Accoring to those logs, no query took more than a couple of ms.
I've also tried to implement a custom IDbCommandInterceptor
that intercepts, times and logs EF queries manually (something like this: https://stackoverflow.com/a/27365855/492067), but I get the same problem there.
What am I missing? Is it something with the actual reading of the data as well?
The EF query in question looks like this:
var duplicates = databaseItems.Where(item => newItems.Contains(item)).ToList();