【发布时间】:2017-07-12 05:40:06
【问题描述】:
使用DbContext 时如何将所有查询记录到输出?
过去,我在 Visual Studio 2015 的“输出”窗口中获取所有查询 (SQL)。我不知道这何时停止。
public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory, DbSeeder dbSeeder)
{
loggerFactory.AddConsole(Configuration.GetSection("Logging"));
loggerFactory.AddDebug();
还有 appsettings.json:
"Logging": {
"IncludeScopes": false,
"LogLevel": {
"Default": "Debug",
"System": "Information",
"Microsoft": "Information"
}
已编辑:
我认为如果没有一些工作是不可能的。 GitHub1, GitHub2.
现在我使用 SQL Server Profiler。
【问题讨论】:
标签: entity-framework asp.net-core