In Entity Framework 6, is it possible to view the SQL that will be executed for an insert before calling SaveChanges?
using (var db =
The easiest way in EF6 To have the query always handy, without changing code is to add this to your DbContext and then just check the query on the output window in visual studio, while debugging.
protected override void OnModelCreating(DbModelBuilder modelBuilder)
{
Database.Log = (query)=> Debug.Write(query);
}
EDIT
LINQPad is also a good option to debug Linq with and can also show the SQL queries.