FastCrud icon indicating copy to clipboard operation
FastCrud copied to clipboard

Log generated sql query

Open mkeymolen opened this issue 8 years ago • 9 comments

It's not really an issue, it's just a possible enhancement. When i find some time, i'll see if i can do it on a fork and create a pull request for it. What i want to do is the following: In a certain situation, i would like to log the generated sql query to the console. When i have difficulties with dataqueries, i can setup sql profiler on MSSQL to see what sql query Fastcrud has generated, but it is not always possible to setup sql profiler(example sqlite). It would be great if we could have a way to see which sql query is send to Dapper to be executed.

mkeymolen avatar Nov 23 '16 20:11 mkeymolen

I find this free tool to be really helpful for that purpose - not sure if that would work with sqllite. But works AMAZING with sql server. It gives full query with all parameters http://stackify.com/prefix.

moxplod avatar Nov 24 '16 00:11 moxplod

Don't need to do anything. Just watch the SQL statements in VS2015 while debugging normally. I believe they're showing in the IntelliTrace window, but I'm not 100% sure. I remember that it can be set up to show lots of other kind of events as well.

MoonStorm avatar Nov 24 '16 02:11 MoonStorm

ok, i'll try it out this weekend. btw, @MoonStorm you created a fantastic library!

mkeymolen avatar Nov 24 '16 12:11 mkeymolen

Dapper shows sql in output window, but fastcrud not. and it saddens

vitidev avatar Dec 01 '16 16:12 vitidev

Try MiniProfiler? http://stackoverflow.com/questions/14318571/how-to-read-an-sql-query-generated-by-dapper

jafin avatar Dec 19 '16 00:12 jafin

As soon i have some freetime the following weeks, i'll try to implement something generic to log the sql query and do a pull request.

mkeymolen avatar Dec 19 '16 11:12 mkeymolen

@mkeymolen and did you? ;-)

kipusoep avatar Dec 22 '17 14:12 kipusoep

@kipusoep Not yet. Working with entityframework core nowadays. I'll see later in 2018. Sorry

mkeymolen avatar Dec 23 '17 19:12 mkeymolen

I don't see any SQL queries in Intellitrace with Dapper FastCRUD. With Entity Framework I do see them.

kipusoep avatar Jan 11 '18 17:01 kipusoep

It has finally stopped working for me as well. I'm assuming it's a problem between .NET Core and the Intellitrace implementation in Visual Studio. Either way, the best way to see the actual SQL, including the parameters, is to use the SQL Profiler whilst your code is running.

MoonStorm avatar Mar 09 '23 00:03 MoonStorm