Repository navigation
DbQuery and command checks share their code - #238
Merged
Merged
Conversation
DbQueryUsing forwards its three state-based reader members to ToCall(), and uses ToCall() where it built the same call by hand. The equality and hash of a bound query and of a call share one helper, with the hash values unchanged. The blank-text checks of a DbQuery and of a parameter name share one helper that takes the message, so both messages and the null-before-blank order are as they were. The command constructors share one command check, called after the transaction is set as before. The checks a caller sees are pinned by tests: each message and argument name, the null and blank order, the sync throw of every member of an unbound query, and the equality and hash of a bound query and a call. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
… assertions The shared text and command checks take a non-null string, as the code they replaced did, so the null checks are not flagged. The test file gets its using, awaits no value task it did not need, compares a message without the argument name the framework appends, and pins the hash of a call (the shared target hash times 31 plus the values' hash). Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The CI format check flagged the object return type of the two helpers (CA1859); they now return nothing, so a throw from the call itself is what the test asserts. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
electricessence
marked this pull request as ready for review
November 24, 2026 23:30
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.
Behavior-preserving code reduction: shared code where the same check or the same call was written twice. No caller-visible change.
DbQueryUsing: the three state-based reader members forward toToCall().Run/RunAsync(the struct's own methods, no interface, no boxing), and the four places that built the same call by hand useToCall(). An unbound value still throwsInvalidOperationExceptionfrom each member, before anything runs.DbQueryand of a parameter name share one helper that takes the message, so both messages, the argument names and the null-before-blank order are as they were. The throw is built out of line so the check stays small on theAddParampath.Left alone on purpose: the sync/async twins (their bodies differ in what they await), the two
AddParamshooks of the plain and theDbCommandcommand (not shareable: the type of a parameter is the generic database type there), and the object and typed parameter loops.Pinned by new tests: each message and argument name, null before blank, the sync throw of every state member of an unbound query, the equality of a bound query and a call, and their hash values.
Verification: full gate on the commit before the last test-only edit (Release and Debug tests on net11.0 and net10.0, 14,489 pass; benchmarks build; 214 sample checks; DocFX; VS MSBuild 0); after the last edit (a helper in the new test file) the new tests (17) and the Roslynator scan (0 on 10 projects) were rerun, not the whole gate. A Haiku swarm with a Sonnet arbiter reviewed it: no behavior or allocation difference found; its test fix is in. Not measured: a micro-benchmark of
AddParambefore and after (by reading, the check is smaller than before).🤖 Generated with Claude Code