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嗎?