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

Improve enum-of-byte handling #164

Merged

Conversation

TobiasMarklund
Copy link
Contributor

Expressions where comparisons of enum-of-byte are made are always cast to int comparisons by the C# compiler. This causes SQL queries to do unnecesary casts of tinyint column like CAST ([column] as int)

Counteract that by detecting comparisons of byte enums with other byte enums or int/byte constants and see if they both can be cast to byte.

Fixes #162

Expressions where comparisons of enum-of-byte are made are always cast to int comparisons by the C# compiler. This causes SQL queries to do unnecessary casts of tinyint column like CAST ([column] as int)

Counteract that by detecting comparisons of byte enums with other byte enums or int/byte constants and see if they both can be cast to byte.
@JonathanMagnan JonathanMagnan merged commit 74dce5b into zzzprojects:master Nov 3, 2019
@JonathanMagnan JonathanMagnan self-assigned this Nov 3, 2019
@JonathanMagnan
Copy link
Member

Hello @TobiasMarklund ,

Thank you for your contribution.

The v3.1.1 has been released. It includes your both pull requests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

Enum-of-byte is unnecessarily cast to int
2 participants