DapperLib / DapperLib/Dapper

DynamicParameters.RemoveUnused does not remove IEnumerable-parameters

Open
#1,241 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C#
Stars
18.4k
Forks
3.7k
Avg merge
5h 8m
Merged PRs (30d)
1

Description

If you use a "collection" parameter, that is unused in command text, it's not removed according to RemoveUnused

int[] list = new[] { 1, 2, 3 };
params.Add("ids", list);

Under the hood Dapper actually adds parameters named @ids1, @ids2, @ids3 and they're not removed if unused in query-text (you can see it with SQL trace)

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at DynamicParameters.RemoveUnused and trace how IEnumerable values are expanded into named parameters such as @ids1, @ids2, and @ids3. Reproduce the issue with the sample collection parameter and an SQL command that does not reference it; done means the expanded unused parameters are removed as RemoveUnused expects.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, sql
Domain
backend, database
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.