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
Using GetQueryAsync with filter odata query, AutoMapper doesn’t use mapping parameters (e.g., userid) when translating the filter expression #246
When using GetQueryAsync with filter odata query, AutoMapper doesn’t use mapping parameters (e.g., userid) when translating the filter expression — even though the projection itself (ProjectTo) does.
I added automapper parameters to GetQueryAsync as ProjectionSettings, resulted sql query has this parameters value exist in mapping part but in the query filter part it was default value.
Expected Behavior:
Both filter mapping and projection should respect the same parameter values —
if ProjectTo receives a parameter dictionary,
then MapExpression should also evaluate mapped members using those same parameter values.
Actual Behavior:
ProjectTo correctly substitutes the runtime parameter into the SQL.
But filter part uses the default value of parameter or null if nullable.
AutoMapper.AspNetCore.OData.EFCore version 8.0.0.0
@BlaiseD yes makes sense but it also means that any filtering that depends on a runtime parameter in the mapper will always fail because the query is already created with the default value of this parameter,
i will create a repro or a test in a PR if that helps.
Activity
BlaiseD commentedon Nov 7, 2025
This library filters before projection - so it makes sense.
Maybe a repro will make your use case clearer?
AmirEmilV commentedon Nov 7, 2025
@BlaiseD yes makes sense but it also means that any filtering that depends on a runtime parameter in the mapper will always fail because the query is already created with the default value of this parameter,
i will create a repro or a test in a PR if that helps.
i did a fix and tested it.
BlaiseD commentedon Nov 7, 2025
Go for it. Consider adding an opt-in flag if you plan to filter against the projection.
AmirEmilV commentedon Nov 16, 2025
Created a PR