Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to log generated sql queries out of Simple.Data ORM for .NET

How to log generated sql queries (without mysql profiler)?

I'm using Simple.Data.Mysql

like image 488
nidheeshdas Avatar asked Feb 15 '12 07:02

nidheeshdas


2 Answers

You have a couple of choices here. You can either set up a trace listener like this and then yes it will show up in the VS output window.

<configuration>
   <system.diagnostics>
      <switches>
         <add name="Simple.Data" value="Info" />
      </switches>
   </system.diagnostics>
</configuration>

Or you can also have a look at the ExampleRunner and ExampleTestListener classes in Simple.Data.Sample for an example of setting it up in code.

like image 138
Dan Maharry Avatar answered Jan 04 '23 17:01

Dan Maharry


All generated SQL statements (plus parameter values) are written to Trace by default, so you can just hook up a Listener.

like image 42
Mark Rendle Avatar answered Jan 04 '23 16:01

Mark Rendle