DapperLib / DapperLib/Dapper.Contrib

Dapper.Contrib character case bug

Open
#12 8 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C#
Stars
293
Forks
109
PR merge metrics
No merged PRs in 30d

Description

Hi!
I have table in postgres created with field names in quotes (i.e. case sensitive):

create table "buttons" (
"Id" SERIAL PRIMARY KEY,
"UserId"  INTEGER,
"Phone"  VARCHAR,
"NumberType" INTEGER,
...

and c# class also with case sensitive properties:

    public class Button
    {
        public Int32 Id { get; set; }
        public Int32 UserId { get; set; }
        public String Phone { get; set; }
        public NumberType NumberType { get; set; }
        ...

When I try to insert record with InsertAsync, it throws an error

42703: column "id" does not exist

as you can see, column "id" is written here in lower case, because the function InsertAsync skips id-column during query creation.

UpdateAsync works perfectly because it uses "Id" in where clause.

But when I change the name of column in database to "id" - InsertAsync works good, but UpdateAsync fails by the same reason.

Please help.

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 by inspecting the InsertAsync and UpdateAsync entry points described in the report, then reproduce the behavior with the quoted PostgreSQL table and C# Button class. The fix is complete when both operations handle the case-sensitive Id and other property names consistently without changing the database naming convention.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, postgresql
Domain
databases
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.