I am working on the mapping from MS SQL database to POCO classes:
I have numeric(19, 0), numeric(18, 0), numeric(3, 0), numeric(3, 0).
I am using the EF power tools to generate POCO and all map to decimal .NET C# Type.
But I think it should map to BigInt, Int64, Int32, Int16 etc.
Here are the .NET integer types and their domains with maximum fitting numeric types:
SByte => -128 to 127 which fits up to NUMERIC(2, 0)
Int16 => -32,768 to 32,767 which fits up to NUMERIC(4, 0)
Int32 => -2,147,483,648 to 2,147,483,647 which fits up to NUMERIC(9, 0)
Int64 => -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807 which fits up to NUMERIC(18, 0)
Since a decimal can hold up to 7.9*10^28, it fits up to NUMERIC(28, 0).
If you have an integer field bigger than NUMERIC(28, 0), you can use BigInteger in .NET 4.0 or newer.
numeric(x, y) will be decimal. If you want int the correct type is:
SQL / C#
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With