DapperLib / DapperLib/Dapper.Contrib

Contrib: Insert - No Return Value if trigger (instead of insert) on table

Open
#87 0 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

Hello together,

I'm aware that following scenario is maybe not a "typical" one, but at least for Dapper.Contrib 1.43 it had worked.

Scenario:
I've got a table which use a "trigger instead of insert as" and within also a merge function. So if the Insert does not exist, it will insert it, otherwise update it.

Issue
The Insert will happen, but I will always receive "0" as value. At least for the 1.50.x (0 and 2 tested) release. The 1.43 return the correct id.

Example
I've created a solution which contain two project (one with Contrib 1.50, one with 1.43) to show the scenario. It's available at https://github.com/Telaran/dapper_trigger_issue

I hope I've provided enough information.

Workaround
Currently I'm not sure which workaround would make more sense: Use 1.43 (I currently don't need any Core Compability) or use 1.50 and always after insert make a query to get the Id.

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 trigger-and-merge scenario with the linked Telaran/dapper_trigger_issue solution, comparing Dapper.Contrib 1.43 with 1.50.x. Trace the Insert behavior involved in returning the generated ID and use the reproduction to verify that an insert-or-update trigger no longer returns 0.

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
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.