DapperLib / DapperLib/Dapper.Contrib
ExplicitKey value is occasionally null upon insert
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 293
- Forks
- 109
- PR merge metrics
- No merged PRs in 30d
Description
Hey Guys!
Just wondering if you've experienced this issue before. We've been using dapper (1.50.0 now) for a while and it all works great but in the past couple of weeks we started seeing null values for explicit primary keys upon inserting objects. It happens randomly, sometimes for one insert but sometimes for all the inserts.
We added logging and the key property always has the value right before the insert but the insert still throws the primary key cannot be null exception. Recycling the app pool fixes it all the time so it might not be dapper related but something with the environment... still wondering if you've ever encountered something like this with Dapper.
Thank you in advance!
Rob
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the intermittent insert failure described for Dapper 1.50.0, comparing the explicit key value immediately before insertion with the database error. Check whether app-pool recycling changes the behavior; done means determining whether Dapper.Contrib or the environment causes the null primary key.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- database
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100