nuget包:Glimpse.WebForms
引用添加完毕web.config自动添加配置项
项目目录下添加了一个“GlimpseSecurityPolicy.cs”用于是否开启控制。
启动项目,访问页面/Glimpse.axd开启,并且可以控制插件的开启状态。
Glimpse.Ado插件
对数据库访问帮助类进行包装:
DbProviderFactory DBProvider = SqlClientFactory.Instance 改为:GlimpseDbProviderFactory<SqlClientFactory> DBProvider = GlimpseDbProviderFactory<SqlClientFactory>.Instance
下面SqlConnection,SqlCommand,SqlDataAdapter,SqlParameter都需要该DBProvider调用相应的Create方法。
其中GlimpseDbDataAdapter "Fill"方法只包含了Fill(DataSet),对于Fill(DataSet dataSet, string srcTable)和Fill(DataTable dataTable)方法是检测不到的,需要反编译该程序集,new这两个相应的函数。
public new int Fill(DataSet dataSet, string srcTable)
{
if (base.SelectCommand != null)
{
GlimpseDbCommand glimpseDbCommand = base.SelectCommand as GlimpseDbCommand;
if (glimpseDbCommand != null)
{
InnerDataAdapter.SelectCommand = glimpseDbCommand.Inner;
int num = 0;
Guid commandId = Guid.NewGuid();
TimeSpan timeSpan = glimpseDbCommand.LogCommandSeed();
glimpseDbCommand.LogCommandStart(commandId, timeSpan);
try
{
num = InnerDataAdapter.Fill(dataSet, srcTable);
}
catch (Exception exception)
{
glimpseDbCommand.LogCommandError(commandId, timeSpan, exception, "ExecuteDbDataReader");
throw;
}
finally
{
glimpseDbCommand.LogCommandEnd(commandId, timeSpan, num, "ExecuteDbDataReader");
}
return num;
}
InnerDataAdapter.SelectCommand = base.SelectCommand;
}
return InnerDataAdapter.Fill(dataSet, srcTable);
}
public new int Fill(DataTable dataTable)
{
if (base.SelectCommand != null)
{
GlimpseDbCommand glimpseDbCommand = base.SelectCommand as GlimpseDbCommand;
if (glimpseDbCommand != null)
{
InnerDataAdapter.SelectCommand = glimpseDbCommand.Inner;
int num = 0;
Guid commandId = Guid.NewGuid();
TimeSpan timeSpan = glimpseDbCommand.LogCommandSeed();
glimpseDbCommand.LogCommandStart(commandId, timeSpan);
try
{
num = InnerDataAdapter.Fill(dataTable);
}
catch (Exception exception)
{
glimpseDbCommand.LogCommandError(commandId, timeSpan, exception, "ExecuteDbDataReader");
throw;
}
finally
{
glimpseDbCommand.LogCommandEnd(commandId, timeSpan, num, "ExecuteDbDataReader");
}
return num;
}
InnerDataAdapter.SelectCommand = base.SelectCommand;
}
return InnerDataAdapter.Fill(dataTable);
}