[英]Can the ServiceStack MiniProfiler show SQL parameter values, not just the bound parameter names?
I've got the ServiceStack MiniProfiler enabled in my AppHost (in Application_Start), and I can view the SQL generated by OrmLite in my page. 我已经得到了ServiceStack MiniProfiler在我APPHOST(在的Application_Start)启用,我可以查看我的网页通过OrmLite生成的SQL。 (using SS v3.9.59.0)
(使用SS v3.9.59.0)
What I can't see in the profile trace is the values of bound parameters. 我不能在轮廓跟踪看到的是绑定参数的值。 So if OrmLite translates a LINQ expression into @0, I can't see the value sent to the DB as part of the query.
因此,如果OrmLite将LINQ表达式转换为@ 0,我无法看到作为查询的一部分发送到DB的值。
Here's an example trace from the profiler: 以下是分析器的示例跟踪:
SELECT "SettingGroup" , "SettingKey" , "LastModified" , "SettingValue"
FROM "GlobalSetting"
WHERE (("SettingGroup" = @0) AND ("SettingKey" = 'a3849d59864b252a2022b4b8a164add1'))
I'd really like to know what value was sent for @0
for this query. 我真的很想知道这个查询为
@0
发送了什么值。
protected void Application_Start(object sender, EventArgs e)
{
Profiler.Settings.SqlFormatter = new InlineFormatter(true);
new AppHost().Init();
}
I've tried a few variants of the Profiler.Settings.SqlFormatter
property: 我尝试了一些
Profiler.Settings.SqlFormatter
属性的变种:
SqlFormatter = new InlineFormatter();
SqlFormatter = new InlineFormatter(true);
SqlFormatter = new SqlServerFormatter();
SqlFormatter
at all, leaving it at its default value SqlFormatter
,将其保留为默认值 All of them have the same result, only showing @0
but not its value. 所有这些都有相同的结果,只显示
@0
但不显示其值。
If I click the "Share" link, I can see the both the bound parameter name and its value in the resulting JSON array. 如果单击“共享”链接,我可以在生成的JSON数组中看到绑定参数名称及其值。 I just can't see it in the rendered profiler output.
我只是在渲染的探查器输出中看不到它。
Any ideas what I need to do to show the parameter values? 有什么想法,我需要做什么来显示参数值?
Answer can be found here : Can MvcMiniProfiler display SQL parameter values? 答案可以在这里找到: MvcMiniProfiler可以显示SQL参数值吗?
Add this to Application_Start 将其添加到Application_Start
MiniProfiler.Settings.SqlFormatter =
new StackExchange.Profiling.SqlFormatters.SqlServerFormatter();
However there seems to be a small issue when using nvarchar / varchar as parameter type. 但是,当使用nvarchar / varchar作为参数类型时,似乎存在一个小问题。 See this topic .
请参阅此主题 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.