Skip to main content

Posts

Showing posts from September, 2020

Running Entityframework profiler on OWIN hosted .NET Framework projects

When you get into DB level issues with your .NET framework application that is using Entity framework, you need to start to examine what is happening under the covers using tools like SQL profiler and/or Entity framework profiler . These can help you track issues and work out strategies to minimise or eliminate nasties like deadlocks. One tool that worked well for me is the entity framework profiler. To utilise this, you need to initialise this with your application code then run the diagnostic tool to be able to capture the requests going into SQL. I did have to do a bit of fiddling around as I could not get it to work out of the box with my current setup of an OWIN hosted project. I noticed the entity framework was being instantiated before the profiler and as a result threw the following exception at startup The Entity Framework was already using a DbConfiguration instance before an attempt was made to add an 'Loaded' event handler. 'Loaded' event handlers can only b