0

I have an application which was initially developed with a very tight deadline, so lazy loading was employed to have a product out the door faster. Well, now performance is a concern and I'm taking some care to go through and explicitly load properties, given that the biggest performance bottleneck by a longshot is pages doing hundreds of database queries thanks to lazy loading. My problem is that for some pages, since I've turned on tracing of each query, I can see that quite a few queries are made, but I can't tell why.

What I would like is a way to spot the code that is causing this. In my ideal world, I could just click something and have "break on database query triggered." Is it possible?

Casey
  • 3,307
  • 1
  • 26
  • 41
  • see this.... http://stackoverflow.com/questions/1412863/how-do-i-view-the-sql-generated-by-the-entity-framework – Ahmed ilyas Oct 08 '14 at 20:54
  • @Ahmedilyas Well, thank you, but as I said, I'm already printing each query to the trace; what I really want is to have the code triggering that SQL highlighted. – Casey Oct 08 '14 at 20:57

1 Answers1

0

I'd highly recommend Mini Profiler written by the Stack Exchange guys. It gives you fantastic feedback and it can be wired into Entity Framework. You'll be able to see all of the sql queries and you can use it to help trace the origination points.

David L
  • 32,885
  • 8
  • 62
  • 93