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

Warn when mapping a TimeSpan to a SQL Server time #22646

Open
ajcvickers opened this issue Sep 21, 2020 · 1 comment
Open

Warn when mapping a TimeSpan to a SQL Server time #22646

ajcvickers opened this issue Sep 21, 2020 · 1 comment

Comments

@ajcvickers
Copy link
Member

ajcvickers commented Sep 21, 2020

By default, EF Core maps .NET TimeSpan to SQL Server time. This is a problematic mapping because time is much more constrained than TimeSpan. We have discussed this many times; for example, see
#242 (comment).

With value conversions, it might be better to map TimeSpan by default to something else, as suggested in #22633. However, this is both a breaking change and may still be problematic until #10434 is robustly implemented.

However, we could generate a warning when this mapping is used.

@FrankSzendzielarz
Copy link

I would also just add to emphasize, though it's probably unhelpful, that mapping TimeSpan to Time is the direct conceptual analogy of mapping Length to Position. In fact, Position modulo 24. I.e. the mapping is just flat out wrong, so a breaking change might be warranted.

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

No branches or pull requests

2 participants