Dapper icon indicating copy to clipboard operation
Dapper copied to clipboard

Improve AI documentation to include Logging preferences

Open EdLichtman opened this issue 5 months ago • 1 comments

Hi all,

So I'm a big fan of the RAG model you used for Dapper AI, and the fact that it can produce examples. I'm also a big fan of the fact that it's been added to Context7, so it can be used within a copilot workflow.

One problem I've seen is there is, according to the AI, no way to log. You can theoretically create your own DbCommand which is a layer of abstraction on top of SqlDbCommand, but unfortunately that doesn't work with Dapper, since you have to give it text.

Therefore, AI suggests that I run the query twice, once to get the raw output and the other time to parse it. Which, as you may be aware, is a non-starter.

While looking online I found this stack overflow question: https://stackoverflow.com/questions/18529965/is-there-any-way-to-trace-log-the-sql-using-dapper

It appears to me that you all, the library developers actually recommend using MiniProfiler library for logging?

Even if you weren't using MiniProfiler, but were using a different library, it would still be super helpful to give the context of "if you need, wrap your SqlConnection with a Sql Profiler library" or something like that.

EdLichtman avatar Jul 24 '25 15:07 EdLichtman

Not sure "we" have done anything AI related, so: I doubt we can take credit there. However, I'm taking from this one of:

  • add documentation discussing profiling/logging via external tools like miniprofiler
  • add an explicit API

The first is easy enough, it just takes a moment. So let's discuss the second: what is your ideal take-away here? What logging / tracing / reporting API would it talk to?

mgravell avatar Jul 24 '25 20:07 mgravell