MiniProfiler - ProfiledDbDataAdapter

前端 未结 1 403
别跟我提以往
别跟我提以往 2021-01-16 15:23

Trying to get MiniProfiler to profile loading a DataTable via a Stored Proc

// Use a DbDataAdapter to return data from a SP using a DataTable
var sqlConnecti         


        
相关标签:
1条回答
  • 2021-01-16 16:16

    It turns out that though ProfiledDbDataAdapter inherited from DbDataAdapter, it did not override the default functionality of DbDataAdapter.Fill(DataTable), leading to the errors that you saw.

    I fixed this in the MiniProfiler code. Fix is available in nuget, version 3.0.10-beta7 and higher.

    I have tested this with your code from above and it works for me:

    DbConnection connection = 
                 new ProfiledDbConnection(sqlConnection, MiniProfiler.Current);    
    var sql = "select * from countries";
    DbDataAdapter dataAdapter = new SqlDataAdapter(sql, sqlConnection);
    ProfiledDbDataAdapter prdataAdapter = new ProfiledDbDataAdapter(dataAdapter);    
    var table = new DataTable();
    dataAdapter.Fill(table);            // this now works
    
    0 讨论(0)
提交回复
热议问题