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. (using 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.
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.
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:
SqlFormatter = new InlineFormatter();
SqlFormatter = new InlineFormatter(true);
SqlFormatter = new SqlServerFormatter();
SqlFormatter
at all, leaving it at its default valueAll of them have the same result, only showing @0
but not its value.
If I click the "Share" link, I can see the both the bound parameter name and its value in the resulting JSON array. 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?
Add this to 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. See this topic.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With