DapperLib / DapperLib/Dapper.Contrib
Dapper.Contrib character case bug
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
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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