EF incorrectly sets "Precision" instead of "Scale" on "VarTime" data types in EFCore.SqlServer #26742
Labels
area-type-mapping
closed-fixed
The issue has been fixed and is/will be included in the release indicated by the issue milestone.
community-contribution
customer-reported
type-bug
Milestone
...as a result, parameters for datetime2, time and datetimeoffset will always have a "fractional seconds precision" of 7 despite being explicitly mapped with a different "precision"
I believe this largely resulted from the fact that in SQLClient, it is the "Scale" property of an SqlParameter that determines the "fractional seconds precision" of the type, not the "Precision" for datetime2, time and datetimeoffset types.
efcore/src/EFCore.SqlServer/Storage/Internal/SqlServerDateTimeTypeMapping.cs
Line 92 in 6da773f
where that should be
parameter.Scale = unchecked((byte)Precision.Value);
for datetime2, time and datetimeoffset types
dotnet/SqlClient#1380 still prevents the correct output when fractional seconds precision is explicitly set to zero though.
Pull request with failing test and fix forthcoming, just need to create the issue first to have something to reference back to..
The text was updated successfully, but these errors were encountered: