Entity framework MvcMiniProfiler能否显示SQL参数值?

Entity framework MvcMiniProfiler能否显示SQL参数值?,entity-framework,ef-code-first,mvc-mini-profiler,Entity Framework,Ef Code First,Mvc Mini Profiler,我一直在尝试作为的替代品,因为它的配置要简单得多 它将很好地显示sql,但我也希望看到参数值 insert [dbo].[PersonName]([Prefix], [GivenName], [MiddleName], [FamilyName], [Affix]) values (@0, @1, @2, @3, @4) select [Id] from [dbo].[PersonName] where @@ROWCOUNT > 0 and [Id] = scope_identity()

我一直在尝试作为的替代品,因为它的配置要简单得多

它将很好地显示sql,但我也希望看到参数值

insert [dbo].[PersonName]([Prefix], [GivenName], [MiddleName], [FamilyName], [Affix])
values (@0, @1, @2, @3, @4)
select [Id]
from [dbo].[PersonName]
where @@ROWCOUNT > 0 and [Id] = scope_identity()
MvcMiniProfiler能否显示sql参数值?

这是我的Global.asax。我首先使用EF4.3.1和代码

protected void Application_Start()
{
    Bootstrapper.Initialize();

    AreaRegistration.RegisterAllAreas();

    RegisterGlobalFilters(GlobalFilters.Filters);
    RegisterRoutes(RouteTable.Routes);

    MiniProfilerEF.Initialize();
}

protected void Application_BeginRequest()
{
    if (Request.IsLocal)
    {
        MiniProfiler.Start(ProfileLevel.Verbose);
    }
}

protected void Application_EndRequest()
{
    MiniProfiler.Stop();
}

如果需要SQL Server格式化程序,请尝试添加:

MiniProfiler.Settings.SqlFormatter = 
    new StackExchange.Profiling.SqlFormatters.SqlServerFormatter();
Application\u Start

中,有两个注意事项:1)它在一个declare语句中添加了sql上方的参数,这便于复制粘贴和直接在ssms中运行。2) 看起来您也可以在_BeginRequest中添加上面的行,它不必在Application _Start中。在我的例子中,我想用一个运行时参数来控制格式。如果不希望SQL显示或查看其他格式化程序的文档,请将其设置为NULL。