Is someone able to please explain why EF doesn't round a decimal by default when the value been stored has more decimal places than the max decimal places in the DB field.
It would be common sense for any sort of application to round a decimal when the store-able decimals (decimals configured in the DB field) are shorter than the calculated value needed to be stored.
At the moment to me it seems as though EF is treating the decimal like a string and truncating the value when storing to the database table.
EDIT/Answer: For anyone struggling on this looking for an easy fix:
I was looking for something that disables truncating.
public UnitOfWork(string connectionString)
{
DataContext = new DbContext(connectionString);
SqlProviderServices.TruncateDecimalsToScale = false;
}
The answer for this question here was exactly what was expected: Entity Framework Code First truncating my decimals