MsSqlCe dialect doesn't give the correct SQL type for Decimal with Scale defined
Description
Environment
None
Activity
Show:
Alex Zaytsev September 8, 2014 at 11:31 AM
Close issues resolved in 3.3.3
Oskar Berggren December 25, 2012 at 6:44 PM
Fixed in dcf37c3422383cc316f3860570569f8f93d0e49b.
Both precision and scale from mappings are now respected.
Fixed
Created December 16, 2011 at 11:39 PM
Updated October 2, 2017 at 4:31 PM
Resolved December 25, 2012 at 6:44 PM
Who's Looking?
In src/NHibernate/Dialect/MsSqlCeDialect.cs, the Decimal type is registered like this:
RegisterColumnType(DbType.Decimal, 19, "NUMERIC(19, $1)");
So the "Scale" part of the type is replaced by the "Length" property. It should take the "Scale" property by defining the parameter as $s, like it is done in the SQL Server dialects for instance.
RegisterColumnType(DbType.Decimal, 19, "NUMERIC(19, $s)");
So calling dialect.GetTypeName(new SqlType(DbType.Decimal, 19, 9) should return NUMERIC(19, 9) and not NUMERIC(19, 0") which is worse than not specifying a scale at all.