Search code examples
.netsql-serverdapper

Dapper exact query being sent to database engine


Looking for a way to get the exact query which is sent to SQL Server after substituting literals / parameters.

Executed code:

result = connection.Query(Of MyList)(query, New With {Key .A = A, Key .B = B, Key .C = C})

I would like to capture (in the code, not at the database server side) exact query where parameters @A, @B and @C are already substituted with its values.


Solution

  • Dapper doesn't provide such a capability. You will have to fork its source code and add this sort of logging yourself.