DapperLib / DapperLib/Dapper.Contrib

Insert return identity 0

Open
#30 4 comments 1 reaction 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

I´m using dapper with mysql and .net and I need to insert and object and recovery the Id insert in this object. I´m using this:

int supplierId = db.Suppliers.Insert( supplier });

This is working in my computer but in the client computer it is returning "0", but the object is inserted in the table, there isn't any errors in the insert, the error is that doesn`t return the last id inserted.

I´m looking for information about insert but I can not find it. Always returns the last id inserted? Or do I have to make another query to consult the last id inserted?

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 reproducing the reported insert through Dapper.Contrib with MySQL and inspect the Insert entry point; the issue names no source file or test. Done means establishing whether returning identity 0 is expected or correcting the behavior, with a regression test if appropriate.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, mysql
Domain
databases
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.