1 year ago
#368429
lonix
Get EF Core generated query including parameters
I need the SQL generated for a query.
Since EF Core 5, we have IQueryable.ToQueryString()
which provides the query itself without parameters.
The best I could find is this, which extracts parameters from the query using reflection. It works for all database providers. However it is for pre-Core EF.
How can I get the query AND parameters - either in the query itself, or as an array of objects like in the linked question? (Using reflection is ok, unless there's a better way.)
c#
entity-framework
entity-framework-core
ef-core-5.0
0 Answers
Your Answer