Extending EF.core SqlTranslatingExpressionVisitor, inspect parameter value

Multi tool use
Extending EF.core SqlTranslatingExpressionVisitor, inspect parameter value
We've extended SqlServerSqlTranslatingExpressionVisitor and override a couple visitor methods in order to rewrite specific parts of query for certain data type / comparisons. This works as expected, but in order to optimize the resulting expression when visiting/translating a given ParameterExpression we need to inspect the corresponding parameter value.
We've spent a few days now examining code and testing different scenarios, but still at no luck. Does anyone know if query parameters (as found on QueryContext.ParameterValues) are accessible in the context of SqlServerSqlTranslatingExpressionVisitor, and if so, how? Any other ideas?
SOLVED:
Found another solution. The original approach was wrong. Due to query compilation expressions should not be altered depending on parameters. We still rewrite certain expressions in SqlServerSqlTranslatingExpressionVisitor to adopt specific SQL Server options, but independent on query parameters.
The required parameter transformations are instead move to as sub-class of ParameterExtractingExpressionVisitor, where we now do initial data type conversion as required.
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.