I have a huge application that uses Entity Framework 4. This is WCF on the server (hosted inside the Windows service) and WPF on the client.
Some of these parts are slow, and I wonder if this is because access to the database is slow.
I would like to constantly measure the performance of this code, for example. register every time the request is executed (preferably, including EF, for example, materialization), analyze somewhere later. How should I do it?
Tools like EFProf (because even if they can measure time, the db server required to execute a specific request, how can I run them within a week?) And Glimpse (this isn’t) t support Windows service and WPF) will not in my case .
I was considering creating my own subclass of SqlConnection, but my version accepts an EntityConnection in an ObjectContext ctor and the EntityConnection is marked as sealed. And this parameter will allow you to measure raw requests for executing sql queries, not EF code.
The only options that I see now are: 1) upgrade to EF 6 and write a subclass of SqlConnection (this will not determine your own EF code); 2) upgrade to later versions and use something like EF hooks library
And, of course, this is not in the book (just looked at the Mastering Enity Framework) - because most of us need to work only with the library, and not know how much this happens quickly (sarcasm).