1

I am attempting to log SQL statements in Entity Framework Core version 6.0.1, however when I attempt the following, I do not get access to the Log property in Visual Studio 2022 autocomplete, and I get a compilation error in my code if I write it manually:

using (var context = new BlogContext())
{
    context.Database.Log = Console.Write;
}

I am using version 6.0.x as the documentation indicates is required to use this feature:

enter image description here

What has me really confused is that if I look at the DatabaseFacade class documentation, which Visual Studio indicates is the type of the Database property, I cannot find the Log property.

Can anyone explain what I'm doing wrong?

1
  • I did, unfortunately the admin deleted the answer. Commented Sep 12, 2023 at 23:42

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.