Logging Generated SQL from DbContext.SaveChanges()
This question seeks a solution to logging generated SQL queries from DbContext.SaveChanges() without external frameworks.
Answer:
In Entity Framework 6.0, this task is simplified by the Database class's Action
// Log SQL queries to the console context.Database.Log = Console.WriteLine;
For more complex requirements, consider using an interceptor.
The above is the detailed content of How Can I Log Generated SQL Queries from DbContext.SaveChanges() in EF6 Without External Libraries?. For more information, please follow other related articles on the PHP Chinese website!