brucezhang80 / dapper-dot-net

Automatically exported from code.google.com/p/dapper-dot-net
Other
0 stars 0 forks source link

Tracing/Logging #29

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
It would be quite nice if we could log the generated Sql (including params) and 
perhaps execution times (both query and mapping).

Perhaps just passing in an optional Action<string>?

cn.Query("select * from foo where foo.Name = @name", new { name = "Foobar" }, s 
=> Console.WriteLine(s));

Original issue reported on code.google.com by b...@planetcloud.co.uk on 29 May 2011 at 11:53

GoogleCodeExporter commented 9 years ago
BTW I realise that we are generating the sql here but in case Dapper does 
evolve into doing some SQL Generation (like insert/update/delete helpers in 
Contrib) then it would be good to log it. 

Original comment by b...@planetcloud.co.uk on 30 May 2011 at 12:02

GoogleCodeExporter commented 9 years ago
agree ... logging is interesting, need to think about this

Original comment by sam.saff...@gmail.com on 1 Jun 2011 at 12:56

GoogleCodeExporter commented 9 years ago
Perhaps some kind of integration with mvc mini profiler? :)

Original comment by b...@planetcloud.co.uk on 7 Jun 2011 at 9:52

GoogleCodeExporter commented 9 years ago
It is of course fully integated with mini-profiler. The reason we didn't say 
that a few days ago is that the DB level hooks have only appeared in the OSS 
profiler drop over the last few days.

Our recommendation is indeed to use ProfiledDbConnection from 
mvc-mini-profiler. You can use that with the extra UI tools if you like, or in 
isolation. We recommend "with" since that gives you the complete end-to-end 
package.

Original comment by marc.gravell on 7 Jun 2011 at 10:17

GoogleCodeExporter commented 9 years ago
Hi Marc, just hooked it up to Dapper and it works great. Since my connections 
are generated from a single factory; in 10 seconds I had all my queries 
profiled. 

You guys are awesome!

Original comment by b...@planetcloud.co.uk on 9 Jun 2011 at 12:04

GoogleCodeExporter commented 9 years ago

Original comment by marc.gravell on 9 Jun 2011 at 6:24