Skip to content
This repository was archived by the owner on Dec 24, 2022. It is now read-only.

Commit be06d47

Browse files
committed
Use custom decimal column def when length or scale != defaults
1 parent 67e8fc8 commit be06d47

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/ServiceStack.OrmLite.SqlServer/SqlServerOrmLiteDialectProvider.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -353,7 +353,8 @@ public override string GetColumnDefinition(string fieldName, Type fieldType, boo
353353
var definition = base.GetColumnDefinition(fieldName, fieldType, isPrimaryKey, autoIncrement,
354354
isNullable, isRowVersion, fieldLength, scale, defaultValue, customFieldDefinition);
355355

356-
if (fieldType == typeof(Decimal) && fieldLength != DefaultDecimalPrecision && scale != DefaultDecimalScale)
356+
if (fieldType == typeof(Decimal)
357+
&& (fieldLength != DefaultDecimalPrecision || scale != DefaultDecimalScale))
357358
{
358359
string validDecimal = String.Format("DECIMAL({0},{1})",
359360
fieldLength.GetValueOrDefault(DefaultDecimalPrecision),

0 commit comments

Comments
 (0)