Entity Framework Tip – Specifying Decimal Precision

1 · Andrew Bancroft · March 29, 2017, 8:57 p.m.
By default, Entity Framework takes the .Net decimal Type and maps it to SQL Server’s decimal(18,2) data type. If you’ve got a property on an Entity that is of Type decimal, but down in your database, you’re allowing for greater precision than 2 decimal places (scale is actually the proper term for the number of places after the decimal), you need to tell Entity Framework this information. Otherwise, decimal values that you save to your database will be truncated at the default 2 decimal places....