efcore
efcore copied to clipboard
Don't log inlined values in SQL unless sensitive data logging is enabled
See https://github.com/dotnet/efcore/issues/13617#issuecomment-805049723
When EF inline a value, then we will stop logging the SQL unless sensitive data logging is enabled. We will instead log a message indicating that sensitive data logging must be enabled to see the SQL.
We will add a flag for do not log in RelationalParameterBasedSqlProcessor.
@AndriySvyryd Look at how to pipe through the flag to RelationalCommand
The flag will be stored in SelectExpression and then passed to IRelationalCommandBuilder
Umm, I can get flat upto relational command builder from query. The issue is that logging is done by Execute method. How does value flow there?
RelationalCommandBuilder would pass it to RelationalCommand as a new parameter in the constructor and then Execute* will pass it as a new parameter to the logging method.
It should be relatively straightforward to have some flag in the query compilation context which says whether things are being inlined, turn it on at the point where inline will happen (i.e. when translating to InExpression/ValuesExpression with a ValuesParameter), and then refrain from logging when that flag is one (and EnableSensitiveDataLogging is off).