Dapper 2.1
Last reviewed Sep 19, 2026
Prompt Details
Prompt Composition
2prompts
- C# 14106 lines · 4.4K tokens
- Dapper 2.159 lines · 2.5K tokens
Total165 lines · 6.8K tokens
CWE Coverage
- 20
- 22
- 59
- 78
- 89
- 94
- 117
- 190
- 208
- 209
- 214
- 250
- 257
- 295
- 319
- 323
- 327
- 338
- 362
- 367
- 378
- 426
- 488
- 502
- 532
- 611
- 636
- 639
- 674
- 759
- 770
- 772
- 775
- 798
- 807
- 862
- 915
- 916
- 918
- 1333
- 1395
Prompt Preview
Apply the C# 14 prompt first. Use these rules for Dapper 2.1.86 applications on .NET 10. Apply the selected ADO.NET provider's parameter, transaction, and connection semantics alongside these rules.
SQL construction
- Pass data separately to
Query,Execute,ExecuteScalar, andQueryMultiple, including their async variants, using an explicit parameter object orDynamicParameters. Ordinary C# string interpolation into the SQL argument does not create parameters. - Select identifiers, sort directions, operators, hints, and complete query fragments from a fixed server-side allowlist. Parameters represent values; they cannot make an untrusted table name, column name, or SQL clause safe.
- Set
commandType: CommandType.Textfor SQL andCommandType.StoredProcedurefor fixed procedure names. Dapper otherwise infers the command type from its text; never let a request select arbitrary command text or procedure names. - Reserve
{=name}literal replacement for reviewed, fixed boolean or numeric constants. Keep changing request, tenant, and authorization values parameterized; literals change the executed SQL and can multiply database query plans. - Review stored procedures called through Dapper for internal SQL construction. Parameterize their dynamic SQL as well; a parameterized outer call does not secure concatenation inside the procedure.
Parameters and collection inputs
- Build a fresh parameter bag from explicitly selected fields. Keep tenant, owner, and privilege parameters server-controlled;
DynamicParameters.Addcan replace an existing name, and