I'm working on a WCF service and I'd like to be able to get a dump of all the SQL queries it makes while I'm running it locally.
Currently its executing sprocs through numerous spread out SqlCommand
's so I'd like to just get a list of every query that is ran.
Is there any sort of tool or configuration that I can setup to log this information? Normally I would just use something like SQL Profiler but I'm looking for something to run from the WCF perspective since I'm hitting an Azure database and SQL Profilier won't work with Azure (afaik)
I'm not aware of a built in way of logging all sql code when using SqlCommand/SqlConnection.
I found this article on msdn: Data Access Tracing in SQL Server 2008 maybe it points you in the right direction.
A simpler but not very generic way i can imagine is to write a class that inherits from SqlCommand and delegates all methods to the real SqlCommand while adding some logging.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With