Skip to content

Align JSON and M.D.Sqlite representations - #36951

Merged
AndriySvyryd merged 9 commits into
dotnet:mainfrom
krisbiradar:fix-timeonly-byte-array-handling-in-sqlite-json-deserialization
Sep 9, 2026
Merged

AndriySvyryd merged 9 commits into
dotnet:mainfrom
krisbiradar:fix-timeonly-byte-array-handling-in-sqlite-json-deserialization

Conversation

@krisbiradar

@krisbiradar krisbiradar commented Oct 10, 2025 •

Copy link
Copy Markdown
Contributor

Fixes #36749

@krisbiradar
krisbiradar requested a review from a team as a code owner October 10, 2025 09:41
@cincuranet cincuranet changed the title fix:Align JSON and M.D.Sqlite representations - Fixes #36749 Align JSON and M.D.Sqlite representations Oct 10, 2025
@krisbiradar

krisbiradar commented Oct 10, 2025 •

Copy link
Copy Markdown
Contributor Author

@dotnet-policy-service agree

@krisbiradar

Copy link
Copy Markdown
Contributor Author

Hi @roji , can we get this merged anytime soon ?

@roji
roji force-pushed the main branch 2 times, most recently from 249ae47 to 6b86657 Compare January 13, 2026 17:46
@krisbiradar

Copy link
Copy Markdown
Contributor Author

Hi @roji would like to see my changes going live any luck with that...?

@roji

roji commented Jan 23, 2026

Copy link
Copy Markdown
Member

@krisbiradar we're unfortunately very backed up with processing community PRs... I promise to do my very best to get this in for EF 11, but it may still take some time.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes issue #36749 by aligning the JSON and Microsoft.Data.Sqlite textual representations for TimeOnly and byte[] types in SQLite. Previously, there were discrepancies where EF Core's JSON representation would preserve trailing zeros for TimeOnly values (e.g., 12:30:45.0000000), while Microsoft.Data.Sqlite would not (e.g., 12:30:45), causing comparison failures.

Changes:

  • Created SqliteJsonTimeOnlyReaderWriter to format TimeOnly values consistently with M.D.Sqlite (omitting trailing zeros when seconds are whole)
  • Modified SqliteByteArrayTypeMapping to detect JSON columns and configure parameters to use text binding for hex-encoded strings
  • Enhanced SqliteValueBinder to convert byte[] to hex strings when binding to text columns (JSON columns)

Reviewed changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
src/EFCore.Sqlite.Core/Storage/Json/Internal/SqliteJsonTimeOnlyReaderWriter.cs New SQLite-specific JSON reader/writer for TimeOnly that matches M.D.Sqlite's formatting
src/EFCore.Sqlite.Core/Storage/Internal/SqliteByteArrayTypeMapping.cs Added JSON column detection and parameter configuration to use text binding
src/EFCore.Sqlite.Core/Storage/Internal/SqliteTypeMappingSource.cs Override FindMapping to return JSON-column-aware byte array mappings
src/EFCore.Sqlite.Core/Storage/Internal/SqliteTimeOnlyTypeMapping.cs Updated to use SqliteJsonTimeOnlyReaderWriter instead of generic JsonTimeOnlyReaderWriter
src/Microsoft.Data.Sqlite.Core/SqliteValueBinder.cs Added logic to convert byte[] to hex strings when binding to text columns (for JSON)
test/EFCore.Sqlite.FunctionalTests/Update/JsonUpdateSqliteTest.cs Updated baselines to reflect new TimeOnly formatting without trailing zeros
test/EFCore.Sqlite.FunctionalTests/Types/SqliteTemporalTypeTest.cs Re-enabled Query_property_within_json test for TimeOnly
test/EFCore.Sqlite.FunctionalTests/Types/SqliteMiscellaneousTypeTest.cs Re-enabled Query_property_within_json test for byte[]
test/EFCore.Sqlite.FunctionalTests/JsonTypesSqliteTest.cs Added test overrides to verify correct TimeOnly JSON formatting
test/EFCore.Sqlite.FunctionalTests/Scaffolding/Baselines/BigModel*/ManyTypesEntityType.cs Updated scaffolding baselines to use SqliteJsonTimeOnlyReaderWriter

@krisbiradar

Copy link
Copy Markdown
Contributor Author

@krisbiradar we're unfortunately very backed up with processing community PRs... I promise to do my very best to get this in for EF 11, but it may still take some time.

Thanks for the update @roji!
looking forward to the release...

@AndriySvyryd AndriySvyryd assigned AndriySvyryd and unassigned roji Jun 9, 2026
@AndriySvyryd

Copy link
Copy Markdown
Member

Please rebase on latest main

@krisbiradar

Copy link
Copy Markdown
Contributor Author

Please rebase on latest main

sure will do!

@AndriySvyryd
AndriySvyryd marked this pull request as draft July 8, 2026 01:50
@AndriySvyryd

Copy link
Copy Markdown
Member

Marking as draft until it's updated

@krisbiradar

Copy link
Copy Markdown
Contributor Author

Marking as draft until it's updated

👍

@krisbiradar
krisbiradar marked this pull request as ready for review August 16, 2026 06:35
@krisbiradar
krisbiradar force-pushed the fix-timeonly-byte-array-handling-in-sqlite-json-deserialization branch from ce15212 to fa1d9d1 Compare August 16, 2026 06:45
@krisbiradar

Copy link
Copy Markdown
Contributor Author

done @AndriySvyryd!
can we get this merged if everything looks fine ?

@AndriySvyryd AndriySvyryd left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your contribution!

@AndriySvyryd
AndriySvyryd merged commit 1c6471a into dotnet:main Sep 9, 2026
14 of 15 checks passed
@krisbiradar

Copy link
Copy Markdown
Contributor Author

Thanks for your contribution!

My pleasure @AndriySvyryd !

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

SQLite: align JSON and M.D.Sqlite representations

4 participants