Repository navigation
Source generator: unannotated models read each member by its type - #271
Merged
Merged
Conversation
A generated reader now reads every member with the provider's getter for the member's type, as a hand-written reader does. This applies to unannotated models too: per result set they check only the column count and names, with no column types and no conversions. The runtime map is unchanged. - Where the column's type is not the member's, the provider converts, coerces or throws, and the value it gives is the provider's (on SQLite, the text `'true'` read into a `bool` is `false`). The generator README lists the conversions the runtime map makes that a generated reader does not. - A `char` or open type-parameter member leaves the model to the runtime map. - On SQLite, dates, time spans and `ulong` read from text or integers can differ from the runtime map's conversion (for example, a `DateTimeOffset` from text without an offset is taken as UTC, not local time). - Tests that exercise the runtime map's conversions now call `Map(RowMap<T>.Default)`, and the fake reader has typed getters, as providers do. New tests on SQLite and SQL Server compare NULL handling with the runtime map: a nullable member gets null, and a NULL in a non-nullable member fails the row in both (the exception inside can differ, as the generator README says). - Benchmarks: the unannotated generated rung now runs on SQLite too. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…e example in the docs A SQL Server test shows that an int member over a bigint column fails, and it is now the only provider example in the generator README and the mapping article. A repeated NULL comment in the emitter header is shortened. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
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.
A generated reader now reads every member with the provider's getter for the member's type, as a hand-written reader does. This applies to unannotated models too: per result set they check only the column count and names, with no column types and no conversions. The runtime map is unchanged.
intmember over abigintcolumn fails). The generator README lists the conversions the runtime map makes that a generated reader does not.charor open type-parameter member leaves the model to the runtime map.ulongread from text or integers can differ from the runtime map's conversion (for example, aDateTimeOffsetfrom text without an offset is taken as UTC, not local time).Map(RowMap<T>.Default), and the fake reader has typed getters, as providers do. New tests on SQLite and SQL Server compare NULL handling with the runtime map: a nullable member gets null, and a NULL in a non-nullable member fails the row in both (the exception inside can differ, as the generator README says). Another SQL Server test proves theint-over-bigintexample.🤖 Generated with Claude Code