We're using Dapper and EF in our shop, and Dapper proofed to be extremely helpful in debugging queries in SQL server when something went wrong. Instead of just submitting raw SQL, we created a thin decorator that also adds some context information (the origin) as an SQL comment, something like
/* Foo.Bar.GetOrders() */ SELECT * FROM Order WHERE orderId > 123
This allows our DBAs and developers to reacy very quickly and find the source of a problem if we have DB calls that are erroneous, or introduce performance hits (we have hundreds of thousands of DB calls per day, so one bad query can cause quite some damage).
We would also like to do this with EF. It doesn't have to be an SQL comment, but some kind of hook in order to supply meta information that is submitted with the call. Any idea whether this is possible?
Thanks for your advice
Philipp