Mid EF Core

How to log or view the SQL that EF Core generates?

  • Enable logging in DbContext options:

optionsBuilder

.UseSqlServer(connectionString)

.LogTo(Console.WriteLine, LogLevel.Information);

  • Or configure logging in ASP.NET Core logging pipeline.

Repository Pattern & Unit of Work

More from Entity Framework Core Tutorial

All questions for this course