Repository navigation
DateOnlyAndTimeOnlyTypes: net10.0 and EF Core 10 native DateOnly/TimeOnly mapping - #2296
Merged
vladimir-pecanac-main merged 2 commits intoOct 19, 2026
Conversation
- Both projects target net10.0. EF Core and Microsoft.Extensions packages 7.0.0 to 10.0.13. - System.Security.Cryptography.Pkcs 10.0.13 referenced directly, so restore no longer reports NU1902/NU1903 for the Pkcs 9.0.11 that Microsoft.Data.SqlClient 6.1.7 brings. - Test packages: xunit 2.9.3, xunit.runner.visualstudio 4.0.1, Microsoft.NET.Test.Sdk 18.11.0, coverlet.collector 10.1.0. - AppDbContext: ConfigureConventions removed (EF Core 8+ maps DateOnly to date and TimeOnly to time). Parameterless constructor added so dotnet ef can create the context. - TimeOnlyConverter, DateOnlyComparer and TimeOnlyComparer deleted. DateOnlyConverter kept for legacy datetime2 columns. - New RemoveDateOnlyTimeOnlyConverters migration (empty Up/Down) and updated model snapshot. - Tests: round trip with a 16:30 end time, schema mapping, query translation and the legacy datetime2 converter case. None needs a database.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Updates the sample for the article "How to Map DateOnly and TimeOnly to SQL Server in EF Core" (https://code-maze.com/csharp-map-dateonly-timeonly-types-to-sql/).
Only dotnet-efcore/DateOnlyAndTimeOnlyTypes changes.
Local run on SDK 10.0.302, runtime 10.0.10: build 0 warnings 0 errors, dotnet test Passed 4 Failed 0.