DapperLib / DapperLib/Dapper.Contrib
Error Insert when table name is Transaction
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 293
- Forks
- 109
- PR merge metrics
- No merged PRs in 30d
Description
I have table name Transaction. I use Dapper.Contrib.Extensions to Insert data and result query is:
insert into Transaction ([TransactionNo], [TransactionDate], [CreatedOn], [UpdatedOn]) values (@TransactionNo, @TransactionDate, @CreatedOn, @UpdatedOn);select SCOPE_IDENTITY() id',N'@CreatedOn datetime,@TransactionDate datetime,@TransactionNo bigint,@UpdatedOn datetime',@CreatedOn='2019-06-29 11:06:22.430',@TransactionDate='2019-02-01 00:00:00',@TransactionNo=1,@UpdatedOn='2019-07-04 13:01:42.147'
I think this error is in https://github.com/StackExchange/Dapper/blob/8b49eb691dd4eaca6d80993130ca8a3d88455111/Dapper.Contrib/SqlMapperExtensions.cs#L829
it should be like this:
var cmd = $"insert into [{tableName}] ({columnList}) values ({parameterList});select SCOPE_IDENTITY() id";
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 in Dapper.Contrib/SqlMapperExtensions.cs around line 829, where the INSERT command is assembled. Reproduce the issue with a table named Transaction and inspect the generated SQL. Done means INSERT works for that reserved table name and the relevant behavior is covered by a test if the repository has an applicable test location.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp, sql
- Domain
- database
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 38/100