2011-09-07 12 views
6

के साथ डैपर मैं डेपर के साथ एमवीसीमिनीप्रोफाइलर का उपयोग करना चाहता हूं। क्या यह "प्रोफाइलर" चरण "ब्लॉक में डैपर से" क्वेरी "कॉल को लपेटने से परे संभव है?एमवीसीएमनीप्रोफाइलर

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 पर की "जाओ" कार्यान्वयन में है:

मैं इस बुनियादी डैप्पर फोन है। क्या डैपर का उपयोग करते समय ProfiledDbConnection का उपयोग करना संभव है?

उत्तर

5

अच्छा पकड़, प्रलेखन पुराना हो चुका है, बस इसे अद्यतन:

कुछ प्रयोग की तरह:

return MiniProfiler.Current != null ? 
     new MvcMiniProfiler.Data.ProfiledDbConnection(cnn, MiniProfiler.Current) : 
     cnn; 

मैं कारखाने क्योंकि मैं लोगों ProfiledDbConnection और स्टैटिक्स बंद के वारिस के लिए सक्षम होना चाहता था मार डाला वर्चुअलाइज्ड नहीं किया जा सकता है।