Is there anyway to see what SQL query EF Core is generating? (ASP .Net Core 1.1)
View sql queries generated by EF Core
Breakpoints with debugger or logging? –
Vanessa
Thanks for the quick reply, and sorry, I should've been more specific... Breakpoint with debugger if possible? –
Rolypoly
Sure. You might also use logger (github.com/aspnet/EntityFramework/issues/5106) –
Vanessa
Refer this answer: https://mcmap.net/q/53782/-how-do-i-view-the-sql-generated-by-the-entity-framework –
Lisabethlisan
Just my opinion, but I believe the easiest, fastest and cleanest solution is to use SQL Profiler.
Just run the SQL Profiler that comes with SSMS, start the trace, execute the action that executes the query, pause the trace and check the exact query that was executed.
It's independent of the EF version you are using.
This answer assumes the MSSQL is the only server for EF Core. –
Flotage
Correct, it doesn't. But it's the definitely the most common database engine used with EF.Not to mention that, for example, the official MySql connector was made available as a pre-release only 3 months after the initial release of v1 of NETCore. NET Core and EF Core 2.0 were released more than 2 months ago and it seems that no official support is yet available. Of course there are other database engines, but EF Core is not the ORM of choice for them. –
Osteoid
@user743414 Right, but there are several workarounds to get similar information that Profiler displays. I never said that Profiler was the only way, but in my humble opinion, it's the best option available to data driven applications. You can check this post from Christos Matskas that gives you two possible solutions to continue profiling the Azure SQL engine. –
Osteoid
© 2022 - 2024 — McMap. All rights reserved.