You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Allow creation of a DbCommand from an EF IQueryable #19358
The command providers access to the SQL query string and parameters.
The created command is not the actual command that EF will use if the query is then executed. A new command will be created for this, but using the same mechanism.
The created command can likely be executed, but will be doing so outside of the normal EF environment and so may not have exactly the same behavior.
Looking at the Source of CreateDbCommand it looks like that the command must be executed before the cache is populated. Is there a way to get the command without actually executing the IQueryable ?
Activity
Giorgi commentedon Mar 16, 2020
Looking at the Source of CreateDbCommand it looks like that the command must be executed before the cache is populated. Is there a way to get the command without actually executing the
IQueryable?ajcvickers commentedon Mar 16, 2020
@Giorgi What "cache" are you referring to?
Giorgi commentedon Mar 16, 2020
I mean this code:
efcore/src/EFCore.Relational/Query/Internal/QueryingEnumerable.cs
Line 88 in b3a89d0
Giorgi commentedon Mar 16, 2020
The code that I linked to in my first comment calls source.Provider.Execute so I guess that is needed to populate the
_relationalCommandCacheajcvickers commentedon Mar 16, 2020
@Giorgi The code for CreateDbCommand does not execute the command. Also, as far as I can tell, it will populate/use the command cache.