Skip to content

EF incorrectly sets "Precision" instead of "Scale" on "VarTime" data types in EFCore.SqlServer #26742

Closed

Description

...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.

parameter.Precision = unchecked((byte)Precision.Value);

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..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions