using latest .Net Core (3.0 preview) and EF Core (3.0 preview) looking at a few online sources I did this:
Program.cs
public class MainWorker : IHostedService {
public static readonly ILoggerFactory ConsoleLoggerFactory =
LoggerFactory.Create(builder => builder.AddConsole();
MyDbContext.cs
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) {
string connectionString = ...
optionsBuilder
.UseLoggerFactory(MainWorker.ConsoleLoggerFactory)
.EnableSensitiveDataLogging(true)
.UseSqlite(connectionString);
}
This all builds and runs fine but when using EF to query my DB instead of the actual SQL queries I only see are entries such as:
info: Microsoft.EntityFrameworkCore.Infrastructure[10403] Entity Framework Core 3.0.0-preview4.19176.6 initialized 'MyDbContext' using provider 'Microsoft.EntityFrameworkCore.Sqlite' with options: SensitiveDataLoggingEnabled
How can I get the actual SQL query for an IQueryable ?
Any help ?