Following the recommendation of this tutorial, I have added the following
public BookServiceContext() : base("name=BookServiceContext")
{
// Keeps track of SQL queries that EF generates
this.Database.Log = s => System.Diagnostics.Debug.WriteLine(s);
}
to the constructor of my DB context model in order to keep track of the SQL queries generated by Entity Framework.
The tutorial forgets to say where the log file lives, so I can't check it.
In which directory will I find the file? I've checked where SQL is installed but none of the files there are the right one.
I know, sounds super-nooby but can people help please?
That line of code will write it's output to the Visual Studio "Output" window. See Logging and Intercepting Database Operations for more info on EF logging.