Skip to content

AddParams on a text command sends only the members its @name markers use (docs corrected, test added) - #129

Merged
electricessence merged 1 commit into
masterfrom
docs/addparams-text-commands
Nov 12, 2026
Merged

electricessence merged 1 commit into
masterfrom
docs/addparams-text-commands

Conversation

@electricessence

Copy link
Copy Markdown
Collaborator

AddParams(object) on a text command: the article said every member is sent; the code sends only the members the text uses.

The question

  • Can a caller safely hand AddParams an object that has more members than the command needs? Yes, when the command's parameter names are known: only the members the command declares are sent, and an unused member is ignored. Documented for a stored procedure already; this pins and documents the text-command case too.

What was wrong

  • expressive-commands.md said that without the procedure's names, "a text command, another provider", every member is sent. A text command that has @name markers is matched against them the same way a procedure's declared names are, so a member with no marker is not sent. Every member is sent, named as written, only when the names are not known: a stored procedure on a provider that cannot report its parameter names, or a text command with no @name marker.

What changes

  • The sentence is corrected.
  • A new test pins the behavior: select 1 where a = @id and b = @region with AddParams(new { Id = 7, Region = "west", Unrelated = true }) sends @id and @region, and Unrelated is not sent.
  • No code changes.

Checks

  • Release and Debug builds: 0 warnings, 0 errors. Tests: 9678 of 9678 pass in both. Samples: 103 of 103 checks pass. Style and analyzers: 0 findings. DocFX: 0 warnings.

🤖 Generated with Claude Code

…re sent (docs corrected, test added)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@electricessence
electricessence merged commit e7a571d into master Nov 12, 2026
2 checks passed
@electricessence
electricessence deleted the docs/addparams-text-commands branch November 12, 2026 14:53
electricessence added a commit that referenced this pull request Nov 12, 2026
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
electricessence added a commit that referenced this pull request Nov 12, 2026
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
electricessence added a commit that referenced this pull request Nov 12, 2026
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
electricessence added a commit that referenced this pull request Nov 12, 2026
Conflicts: the SingleResult wording in mapping.md and the MappedQuery remarks keep master's text with this branch's
First and Single additions; whats-new keeps both sets of bullets.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant