Repository navigation
Review fixes for the generator and shared-internals refactors, and dead code removed - #305
Merged
Merged
Conversation
… cut repeated comments Follow-up to the shared-code change, after the merge of master: - Views.CommandCore is back to its two-branch form: the command inside a SingleResultDbCommand is never null (the one place that makes it checks the argument), so a fallback for null was dead code. - ExpressiveDbCommand's `: base(` line keeps its original indentation; only the argument changed. - Lines that this change added are wrapped at about 80 columns (the text-name helper, the procedure lookup command, the schema table reads, the NoMatch call). - Comments that repeated what the next line says are removed (the bounds helper of ChunkSizes, the integer reader and the schema check of the procedure metadata, the chunk release in the stream). No behavior change, no public API change, no cost per call or per row. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
A six-line helper is not worth a shared Core internal that two packages call. The channel pump and the block pump each have their private CloseAsync again, with the body they had before the helper was shared; the shared class is gone. No other change. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
… call on one line Layout fixes in the generator's own code, no change to its behavior or to the text it emits. The two Nullable helpers in ModelReader put their expression body's arrow on the next line, and the partial check in ModelReader keeps its single call chain on one line. The generated file of the generator tests (counters on and off) and of the generated benchmarks is byte-identical to the one the generator made before the previous change, so that change's two partial-model Bind sites are covered too: five models exercise one, two trusted models the other. Checks: whole solution Release build without warnings; generator tests in Release; dotnet format style and analyzers on the generator. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Internal removals and consolidation. No behavior change and no cost per call or per row: everything removed was never read, or is the same code written twice. - The source generator no longer emits the layout's `Ordinals` field and the `l.Ordinals = o;` store: nothing reads it. This changes the generated text, and only that: a before and after comparison of the generated files differs by exactly those lines (the field and its comment once, the store once per layout). No test compares the generated text. - The command-path cancellation token store on an output run is dropped from the two query-definition paths that never read it (the command path sets and reads its own). - The private `EnsureOpen` and `EnsureOpenAsync` command helpers, each with one caller, are inlined at that caller. - `IterateWhileAsyncInternal` no longer repeats the null checks that both of its callers already make. - The non-generic `ConnectionFactoryToPoolAdapter` is deleted. `AsPool` on a factory or a function now returns the generic adapter over `IDbConnection`, and the name-cache owner switch loses its second arm. A null factory still names `factory` in the exception. - `ArrayMapper` and its region are documented with their real callers (the output and capture reads), not "generated code" and the Channel and Dataflow pipelines. - A comment that said the same thing twice on the per-model-type statics of `RowMap<T>` is folded into one. - The sentence about `DbQuery.Using` throwing for a null source is written once per type in the scalar and non-query definitions instead of on every overload. - The two `SingleResult` doc blocks share their common paragraphs through one include in `Mapped.docs.xml`. - An unused `using static` in the MSSqlClient synchronous transaction extensions is removed. - `DirectStream.HasTimer`, an `internal` member of an internal type, is `public`. Checks: solution Release build with no warnings on every target framework; Core and Generator tests in Release; `dotnet format` style and analyzers at info severity on the touched projects and their tests; the docs build. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…comment The non-generic connection-factory adapter stays. Making AsPool return the generic adapter would change what the procedure-name cache shares between commands built from one factory function (it would share across them, where today each command has its own), which is a behavior change and not a refactor. Also: the first call of three chains stays on its receiver's line, the schema comparison's arguments are grouped, and the comment above the Using overloads says it covers every overload of the type. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The shared helper in Core stays: both pumps call AsyncEnumerators.CloseAsync, as before the earlier commit of this branch, which removed it. 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.
Follow-up to the generator refactor (#303) and the shared-internals refactor (#304), which merged before their review fixes, plus a round of dead-code and duplicated-text removal. Internal only: no public API change, and the generated text changes in one place, named below.
Review fixes for #303 and #304
IsNullableValueandUnderlyingput=>on the next line, and theIsPartialcall chain is one line. The generated text for theBindchange in Generator: share repeated code, no change to the generated text #303 was proved byte-identical for both emit sites: baseline from the generator before Generator: share repeated code, no change to the generated text #303,diff -rempty over the generated files of the generator tests (counters on and off) and the generated benchmarks; the five models that exercise the first site and the two that exercise the second are listed in the proof.ExpressiveDbCommandkeeps its formatting, added code lines are wrapped to the column limit, and four comments that repeated the same file's text are cut.ProcedureSchemaNames.Namesthe check for rows from more than one schema now runs before the row loop. A malformedORDINAL_POSITIONon a row that comes before a row of another schema now returns no names instead of throwingFormatException; the result for a well-formed table is identical.Dead code and duplicated text removed
Ordinalsfield of a layout or thel.Ordinals = o;line that stored into it: nothing read it. This is the one change to generated text: 70 lines in the generated test file (the field once, the store 17 times), and no test compares the generated text.ArrayMapperdocumentation names its real callers (the capture and output reads) and drops "for generated code"; one duplicated comment inRowMap.csis folded.Token =stores in the stored-definition output run, which nothing read, are gone; the repeated guards inIterateWhileAsyncInternalare gone (both callers guard first).SingleResultdocumentation blocks are one shared include.EnsureOpenwrappers are inlined, an unusedusing staticis removed, and a member of an internal type that saidinternalsayspublic.Left out on purpose: removing the non-generic connection-factory adapter. Making
AsPoolreturn the generic adapter would change which commands share procedure names (commands built from one factory function would share them), and that is a behavior change, not a refactor. It is the owner's call.Cost
Nothing per call or per row. The only change on a run path is the generated layout setup, which no longer stores the ordinals (once per layout).
Reviews
Two lenses of Haiku reviewers (correctness of what was removed; repository rules and documentation) read the diff. Applied: the adapter change was reverted (the finding above), the first call of three chains stays on its receiver's line, the schema comparison's arguments are grouped, and the comment above the
Usingoverloads says it covers every overload of the type. Not applied: three removed comments whose text repeated the same file.Checks: Release 16,151 and Debug 16,130 tests pass (16 skipped), 0 build warnings on every target framework, 267 sample checks, VS MSBuild 0 errors,
dotnet formatstyle and analyzers clean on all 28 checks, DocFX 0 warnings, the style scan clean.🤖 Generated with Claude Code