Dapper.Contrib
Dapper.Contrib copied to clipboard
dapper.contrib insert single data always return 0 but the data is inserted in database successfully
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<User> users = new List<User>(); users.add(user);
and then call Insert(users) return 1;
I don't know why.....Thanks for your help!
At a guess, it is expecting to return the "identity", but that table doesn't have an "identity" column (a guid primary key is not the same)
On 19 Aug 2016 1:42 p.m., "Moonlight" [email protected] wrote:
I have a simple user class,
public class User { 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!
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/StackExchange/dapper-dot-net/issues/587, or mute the thread https://github.com/notifications/unsubscribe-auth/AABDsBvI94PNGy3tc80bi_GBtHR9UZEuks5qhaS3gaJpZM4JocC- .
Nobody met this problem?
Suggestion?
The issue is Dapper trying to get a int out of this. We'll fix with generics in v2, tagging as such.