DapperLib / DapperLib/Dapper

Dynamic Parameters Naming for DB2

Open
#1,138 2 comments 0 reactions 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

Using Dapper for DB2 queries with the IBM.Data.DB2.iSeries driver works well, but there is an issue with the way parameters are handled. DB2 supports named parameters (and positional), but the parameter name MUST begin with the @ symbol, which DynamicParameters strips off by default: https://github.com/StackExchange/Dapper/blob/4e62055c5775aced61b848282ed180de0ab62161/Dapper/DynamicParameters.cs#L139

If the parameters are not named with the @ symbol, the variable matching defaults to positional within the statement, which can introduce hard-to-find bugs.

Because that Clean method is private/static, I don't see an easy way to change that default behavior. Is there some way to make that 'Clean' function optional at the connection/command level?

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 in Dapper/DynamicParameters.cs at the Clean method linked in the issue, then investigate how IBM.Data.DB2.iSeries handles parameter names. Determine how an optional connection- or command-level behavior could preserve the @ prefix without changing existing behavior. Done means DB2 named parameters work reliably while current parameter handling remains compatible.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, sql
Domain
database
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.