I know you can access the raw SQL generated by Linq To Sql, but is it possible to use Linq To Entities to build a query and then access to generated SQL?
The reason I need to do this is because I would like to use Linq To Entities instead of a query builder, and then pass that SQL query onto Dapper which is much faster than the Entity Framework. Does this approach make any sense?
Oh, and I need it in .NET core. The linked duplicate question is about the same thing but for .NET framework.
Say I have something like this:
        // dummy Entities
        DbContext context = null;
        DbSet<Student> students = null;
        // my Linq To Entities query
        var student = students.Where(st => st.Standard == 1)
                                .Select(st => new {
                                    Id = st.StudentId,
                                    Name = st.StudentName
                                });
        // how do I access the SQL for that?
 
     
    