C# 使用ServiceStack探查器评测SQL但失败
我正在使用global.asax以外的另一个文件进行ServiceStack配置,如下所示:C# 使用ServiceStack探查器评测SQL但失败,c#,sqlite,mvc-mini-profiler,
ormlite-servicestack,C#,Sqlite,Mvc Mini Profiler,
ormlite Servicestack,我正在使用global.asax以外的另一个文件进行ServiceStack配置,如下所示: public class ApiAppHost : AppHostBase { public ApiAppHost() : base("OpenTaskApi", typeof(MyService).Assembly) { } public override void Configure(Container container) { co
public class ApiAppHost : AppHostBase
{
public ApiAppHost() : base("OpenTaskApi", typeof(MyService).Assembly) { }
public override void Configure(Container container)
{
container.Register<IDbConnectionFactory>(
new OrmLiteConnectionFactory(
ConfigurationManager.ConnectionStrings["db"].ConnectionString,
false,
ServiceStack.OrmLite.SqliteDialect.Provider) {
ConnectionFilter = x=>
new ProfiledDbConnection(x,Profiler.Current)
}
);
}
}
我得到的分析器只在请求上工作,而不分析sql,如下面的picutrue所示
请注意:我使用的是asp.net项目而不是asp.net mvc作为我的服务容器。
如何将此代码修复为评测SQL?评测器对评测SQL的请求根本不起作用?或者它仍然有效,只是没有在分析器中显示sql?
protected void Application_Start(object sender, EventArgs e)
{
new ApiAppHost().Init();
}
protected void Application_BeginRequest(object sender, EventArgs e)
{
Profiler.Start();
}
protected void Application_EndRequest(object sender, EventArgs e)
{
Profiler.Stop();
}