6
我想将MVCMiniProfiler与Dapper一起使用。这可能超越在“使用Profiler.Step”块包装来自短小精灵的“查询”调用吗?小巧玲珑MVCMiniProfiler
我有这个基本的通话小巧玲珑:
Dim comments As List(Of Comment)
Using conn = New SqlConnection(ConnectionString)
conn.Open()
comments = conn.Query(Of Comment)("SELECT * from comments where userid = @userid", New With {.userid= 1})
End Using
的MiniProfiler例子来说明这种
Private Shared _sqlConnection As SqlConnection
Public Shared Function GetOpenConnection() As DbConnection
If _sqlConnection Is Nothing Then
_sqlConnection = New SqlConnection("connection string")
End If
' wrap the connection with a profiling connection that tracks timings
Return MvcMiniProfiler.Data.ProfiledDbConnection.[Get](_sqlConnection, MiniProfiler.Current)
End Function
我在哪里卡住是在“获取”关于ProfiledDbConnection实施。在使用Dapper时可以使用ProfiledDbConnection吗?