-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
Unsigned type mapping overflow #1164
Comments
Just hit this now with uint to bigint too |
I fixed this by adding a custom handler for each of the unsigned types - though i think this should really be built in
|
Oooh that's clever, thanks 😄 👍 |
Tagging this as 2.0 - I agree adding these handlers in the box in the next release seems correct on the surface. Going on the list. |
I encountered the same when trying to map (dap?) a |
I think I found the root of the issue. I suspect method Dapper version: 2.0.4
Mapping type:
|
Fix unsigned types mapping arithmetic overflow Add tests to reproduce issue DapperLib#1164
Fix unsigned types mapping arithmetic overflow Add tests to reproduce issue DapperLib#1164
When querying to a strongly type object which uses an unsigned short (ushort) you get an arithmetic overflow if the SQL value is greater than short.MaxValue (32767).
The SQL data type is an INT (best used for ushort values)
The mapping looks to be ignoring the fact its converting to an unsigned value which should allow twice the size (65535)
Errors
"Arithmetic operation resulted in an overflow."
Error parsing column 21 (XX=65535 - Int32)
The text was updated successfully, but these errors were encountered: