В мини Profiler документации вы можете сделать следующее:Servicestack позволяет MiniProfiler на собственном DB Connection
public static DbConnection GetOpenConnection()
{
var cnn = CreateRealConnection(); // A SqlConnection, SqliteConnection ... or whatever
// wrap the connection with a profiling connection that tracks timings
return new StackExchange.Profiling.Data.ProfiledDbConnection(cnn, MiniProfiler.Current);
}
Как включить профилированное подключение к БД в Servicestack с использованием Servicestack версии реализации Miniprofiler на моем собственном подключении БД. У меня есть функция, которая возвращает строку соединения вместо использования встроенной базы servicestack.Db.
public static DbConnection GetOpenConnection(string ConnectionName)
{
string provider = ConfigurationManager.ConnectionStrings[ConnectionName].ProviderName;
string connectionstring = ConfigurationManager.ConnectionStrings[ConnectionName].ConnectionString;
DbProviderFactory factory = DbProviderFactories.GetFactory(provider);
DbConnection cnn = factory.CreateConnection();
cnn.ConnectionString = connectionstring;
cnn.Open();
//this is ServiceStack current profiler for request and response DTO's
Profiler profiler = Profiler.Current;
// I want to return a profiled db connection here that will include the connection profiles into the current Profiler data.
return cnn;
}