DapperLib / DapperLib/Dapper.Contrib

cannot handle numeric identities when they > max integer value

Open
#113 1 comment 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

System.OverflowException: Value was either too large or too small for an Int32.
at System.Decimal.ToInt32(Decimal d)
at System.Decimal.op_Explicit(Decimal value)
at SqlCeServerAdapter.Insert(IDbConnection connection, IDbTransaction transaction, Nullable1 commandTimeout, String tableName, String columnList, String parameterList, IEnumerable1 keyProperties, Object entityToInsert) in //Dapper.Contrib/SqlMapperExtensions.cs:line 884
at Dapper.Contrib.Extensions.SqlMapperExtensions.Insert[T](IDbConnection connection, T entityToInsert, IDbTransaction transaction, Nullable`1 commandTimeout) in /
/Dapper.Contrib/SqlMapperExtensions.cs:line 377

var id = (int)r[0].id;

in \SqlMapperExtensions.cs

line 884 - cannot handle numeric identities when they > max integer value

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 in SqlMapperExtensions.cs at line 884, following the SqlCeServerAdapter.Insert stack trace and the cast of the returned identity value to int. Reproduce an insert whose numeric identity exceeds the Int32 maximum and verify that insertion and identity handling complete without the reported OverflowException.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
databases
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.