MiniProfiler - SqlParameter

Uni*_*ack 5 sql-server asp.net-mvc-3 mvc-mini-profiler

我正在使用最新版本的MiniProfiler,一切都按照我的预期设置和工作.我唯一的问题是没有显示SqlParameters.

例如,我正在运行存储过程: -

var cmd = dbcon.CreateCommand();
cmd.CommandText = "USP_Admin_Subscription_List";
cmd.CommandType = CommandType.StoredProcedure;

// parameters
cmd.Parameters.Add(new SqlParameter("@UserRef", SqlDbType.NVarChar) { Value = customerRef });
Run Code Online (Sandbox Code Playgroud)

执行此操作时,我在MiniProfiler显示中看到SQL,但是我没有看到参数@UserRef,也没有看到它的值.

这可能吗?很高兴看到这个值,所以我可以确保传递正确的值.

我正在使用MVC 3

任何建议都会受到欢迎.

干杯,

Ĵ

Big*_*ave 6

旧问题,但以防万一其他人正在寻找答案:

示例代码包含:

    // different RDBMS have different ways of declaring sql parameters - SQLite can understand inline sql parameters just fine
    // by default, sql parameters won't be displayed
    MiniProfiler.Settings.SqlFormatter = new StackExchange.Profiling.SqlFormatters.InlineFormatter();
Run Code Online (Sandbox Code Playgroud)

您需要将其更改为:

MiniProfiler.Settings.SqlFormatter = new StackExchange.Profiling.SqlFormatters.SqlServerFormatter();
Run Code Online (Sandbox Code Playgroud)

您的参数将出现.