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

Support the new BCL DateOnly and TimeOnly structs #1361

Closed
roji opened this issue Mar 25, 2021 · 12 comments · Fixed by #1501
Closed

Support the new BCL DateOnly and TimeOnly structs #1361

roji opened this issue Mar 25, 2021 · 12 comments · Fixed by #1501

Comments

@roji
Copy link

roji commented Mar 25, 2021

New DateOnly and TimeOnly structs are being introduced to .NET 6 as alternatives to DateTime (dotnet/runtime#49036). MySqlConnector issue: mysql-net/MySqlConnector#963.

@mattjohnsonpint
Copy link

Please note that the final names for these types are DateOnly and TimeOnly and that they are now merged into the main branch for the next version of .NET 6 (preview 4 likely). Please rename the title of this issue accordingly. Thanks.

@roji roji changed the title Support the new BCL DateOnly and TimeOfDay structs Support the new BCL DateOnly and TimeOnly structs Apr 15, 2021
@lauxjpn lauxjpn added this to the 6.0.0 milestone Apr 26, 2021
@lauxjpn
Copy link
Collaborator

lauxjpn commented May 16, 2021

They are coming in .NET 6 Preview 4.

@roji
Copy link
Author

roji commented May 16, 2021

@lauxjpn yes.

Note that it may be a good idea to hold off here (and in Npgsql) until support is added in EF Core itself (dotnet/efcore#24506, dotnet/efcore#24507), this way the specification tests will already be added upstream. I hope to make that happen pretty quickly after the preview4 release.

@uzairali001
Copy link

uzairali001 commented Sep 2, 2021

Any news?
When I'm trying to create migrations it shows this error
The property 'MyEntity.LastCalled' could not be mapped because it is of type 'DateOnly?', which is not a supported primitive type or a valid entity type. Either explicitly map this property, or ignore it using the '[NotMapped]' attribute or by using 'EntityTypeBuilder.Ignore' in 'OnModelCreating'.

Dotnet version: 6.0.100-preview.7.21379.14
Pomelo Version: 6.0.0-preview.5

@roji
Copy link
Author

roji commented Sep 2, 2021

FYI support in EF Core has been added for Sqlite, including functional tests.

@lauxjpn
Copy link
Collaborator

lauxjpn commented Sep 5, 2021

Any news?

We will implement it in the near future.

@BrokenShoeLace
Copy link

Using EF 6.05 and the same error as @uzairali001 on VS2022 for Microsoft SQL 2019

@mguinness
Copy link
Collaborator

@BrokenShoeLace If you're using MS SQL then please look at dotnet/efcore#24507.

@BrokenShoeLace
Copy link

Thanks for the link but ut doesnt address my issue:

TimeOnly is not DateOnly

@lauxjpn
Copy link
Collaborator

lauxjpn commented Jun 3, 2022

@BrokenShoeLace Please clarify: Are you using Pomelo.EntityFrameworkCore.MySql or Microsoft.EntityFrameworkCore.SqlServer?

@BrokenShoeLace
Copy link

Microsoft.EntityFrameworkCore.SqlServer

@roji
Copy link
Author

roji commented Jun 3, 2022

Microsoft.EntityFrameworkCore.SqlServer doesn't support DateOnly/TimeOnly, because the underlying SqlClient doesn't - the issue tracking that is dotnet/SqlClient#1009. Once that's done, support in EF Core can be enabled in dotnet/efcore#24507.

This is the respository for the Pomelo MySQL provider, so not related to SQL Server.

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

Successfully merging a pull request may close this issue.

6 participants