Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix to #19128 - Query: Error for queries with enum parameters whose value is of underlying type but the value expected by type mapping is the actual enum type #20081

Merged
merged 1 commit into from
Mar 4, 2020

Conversation

maumar
Copy link
Contributor

@maumar maumar commented Feb 26, 2020

Problem was that we were not correctly compensating for type differences between parameter value and the DbParameter type (determined from type mapping). This can happen when the parameter is explicitly typed as the underlying type, but in the query the type is inferred from other side of binary expression etc.

Fix is to detect the case when expected parameter value is Enum, but the actual type is the underlying type and convert the value back to the enum type, just like we do for constants.

Fixes #19128

@maumar maumar force-pushed the fix19128 branch 2 times, most recently from e8f0756 to 1163dba Compare February 26, 2020 23:57
@maumar
Copy link
Contributor Author

maumar commented Mar 3, 2020

@ajcvickers, Smit wanted you too look at this as well

…alue is of underlying type but the value expected by type mapping is the actual enum type

Problem was that we were not correctly compensating for type differences between parameter value and the DbParameter type (determined from type mapping). This can happen when the parameter is explicitly typed as the underlying type, but in the query the type is inferred from other side of binary expression etc.

Fix is to detect the case when expected parameter value is Enum, but the actual type is the underlying type and convert the value back to the enum type, just like we do for constants.

Fixes #19128
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants