DapperLib / DapperLib/Dapper.Contrib

dapper.contrib insert single data always return 0 but the data is inserted in database successfully

Open
#84 4 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

I have a simple user class,

public class User
{
[Key]
public GUID UserId {get; set;}
public string Firstname {get; set;}
public string Lastnmae {get; set;}
}

When I call Insert(user) mehtod, alwasy return 0;

But I put user in list

List users = new List(); users.add(user);

and then call Insert(users) return 1;

I don't know why.....Thanks for your 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 reproducing the issue with the User class and the single-object Insert(user) and list-based Insert(users) entry points described in the report. Compare their return values with the database state, then inspect the relevant insert implementation to determine why the two calls differ. Done means the single-object insert returns the expected result while still inserting the record successfully.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
database
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.