When using table valued parameters, Insight needs to map from the .NET
type (e.g. decimal) to the SQL Server type (e.g. decimal or money).
The mapping from the decimal .NET type to decimal SQL Server type works
by default, but if the type in SQL Server is money, values in the
decimal places are truncated and lost. Since we know the data type in
the database via metadata, use the same approach that has been taken for
datetime2 (which also has multiple SQL Server types mapping to a single
.NET type).
Note that this problem only seems to manifest itself in the .NET
Standard build. The new test failed prior to fixing when run under .NET
5, but not under .NET 4.5.1. It could be that the .NET Framework SQL
Server libraries are more forgiving of this situation.
Description
Fixes #475.
Checklist
Please make sure your pull request fulfills the following requirements:
[x] Tests for any changes have been added (for bug fixes / features).
[x] Docs have been added / updated (for bug fixes / features).
Type
This pull request includes what type of changes?
[x] Bug.
[ ] Feature.
[ ] Code style update (formatting, local variables).
[ ] Refactoring (no functional changes, no api changes).
[ ] Documentation content changes.
[ ] Other (please describe below).
Breaking Changes
Does this pull request introduce any breaking changes?
When using table valued parameters, Insight needs to map from the .NET type (e.g. decimal) to the SQL Server type (e.g. decimal or money). The mapping from the decimal .NET type to decimal SQL Server type works by default, but if the type in SQL Server is money, values in the decimal places are truncated and lost. Since we know the data type in the database via metadata, use the same approach that has been taken for datetime2 (which also has multiple SQL Server types mapping to a single .NET type).
Note that this problem only seems to manifest itself in the .NET Standard build. The new test failed prior to fixing when run under .NET 5, but not under .NET 4.5.1. It could be that the .NET Framework SQL Server libraries are more forgiving of this situation.
Description
Fixes #475.
Checklist
Please make sure your pull request fulfills the following requirements:
Type
This pull request includes what type of changes?
Breaking Changes
Does this pull request introduce any breaking changes?
Any other comment
(n/a)