Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
EamonHetherton opened this issue Nov 18, 2021 · 0 comments
Assignees
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

Comments

@EamonHetherton
Copy link
Contributor

EamonHetherton commented Nov 18, 2021

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

EamonHetherton added a commit to EamonHetherton/efcore that referenced this issue Nov 18, 2021
@ajcvickers ajcvickers added this to the 7.0.0 milestone Nov 19, 2021
@ajcvickers ajcvickers self-assigned this Nov 19, 2021
EamonHetherton added a commit to EamonHetherton/efcore that referenced this issue Dec 6, 2021
EamonHetherton added a commit to EamonHetherton/efcore that referenced this issue Dec 6, 2021
ajcvickers pushed a commit that referenced this issue Dec 6, 2021
@ajcvickers ajcvickers added the closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. label Dec 6, 2021
@ajcvickers ajcvickers modified the milestones: 7.0.0, 7.0.0-preview1 Feb 14, 2022
@ajcvickers ajcvickers modified the milestones: 7.0.0-preview1, 7.0.0 Nov 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
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
Projects
None yet
Development

No branches or pull requests

2 participants