Dapper.Contrib icon indicating copy to clipboard operation
Dapper.Contrib copied to clipboard

Dapper.Contrib Insert returns long but InsertAsync returns int

Open Caltor opened this issue 7 years ago • 7 comments

In Dapper.Contrib the Insert method returns a long but InsertAsync returns an int. Could you have both returning the same for consistency please? I personally would prefer int (32 bits) but I understand some people might need long (64 bits).

Caltor avatar Apr 23 '18 09:04 Caltor

What's interesting is that returnVal internally is defined as an int. You should be able to safely cast it to an int.

ltctech avatar Oct 19 '18 20:10 ltctech

I, too, had this problem in production when a certain amount of rows in a table were surpassed (int.maxvalue) and the method signature of the Insert<T> method didn't immediately give away the problem.

So either change everything to long, or add additional methods, aka InsertLong, ect. ..

However, the method signature right now is misleading, or "wrong" if you will.

ThomasBergholdWieser avatar Jul 01 '19 10:07 ThomasBergholdWieser

Is this somehow addressed?

kamil-mrzyglod avatar Oct 04 '19 10:10 kamil-mrzyglod

@kamil-mrzyglod I solved it by cloning the repo and replacing the respective code (its only at 2-3 places).

ThomasBergholdWieser avatar Oct 04 '19 10:10 ThomasBergholdWieser

@ThomasBergholdWieser Naah, it's not exactly the solution I'm seeking right now.

kamil-mrzyglod avatar Oct 04 '19 10:10 kamil-mrzyglod

What if the Id to be returned is string or Guid?

makcakaya avatar May 31 '20 19:05 makcakaya

Will this be ever addressed or is dapper contrib team not planning to support this?

jtambe avatar Apr 20 '23 21:04 jtambe