win7user10 / Laraue.EfCoreTriggers

Library to write triggers in C# with EF.Core
MIT License
114 stars 22 forks source link

Support more than 2 decimal places in decimal data types #105

Closed ddashwood closed 2 months ago

ddashwood commented 3 months ago

In the SQL Server type mappings, "decimal" is mapped to "decimal(18,2)".

I have some decimal data with more than 2 decimal places, and this type mapping causes data loss when the data is accessed in a trigger.

The maximum precision of a Decimal in SQL Server is 38, so I'd suggest using this. The choice of scale is more subjective, but I'd suggest using 10 - this would still allow for 28 digits before the decimal place, a significant increase on the current value. Thus, I'd suggest using a type mapping to "decimal(28,10)".

ddashwood commented 2 months ago

Happy to close this, because I discovered that I could achieve what I needed by extending the SqlServerTypeMappings class