InsertAsync returning 0 as Id on a class that has ExplicitKey attribute on Id
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 35/100
Research direction
Reproduce the issue with the Customer class and conn.InsertAsync(customer).Result, then trace the InsertAsync implementation and its ExplicitKey handling. Check related tests for insert return values; done means a manually supplied Id is acknowledged or a clear success result is provided, with regression coverage.
Written by the indexing model from the issue text.
Description
` public class Customer
{
[ExplicitKey]
public int Id { get; set; }
[Write(false)]
public string FullName { get; set; }
public string Username { get; set; }
public string Email { get; set; }
public string EmailToRevalidate { get; set; }
public string SystemName { get; set; }
public int BillingAddress_Id { get; set; }
public int Add(Customer customer)
{
using (IDbConnection conn = Connection)
{
var result = conn.InsertAsync(customer).Result; // need to fix this it is return 0 because of the explicitkey attribue on ID.
return result;
}
}
`
I need this function to return the "manually" inserted Id / Object back. Or somehow check if the insert was successful.
I believe this is somewhat buggy if it just return 0 and does not acknowledge the fact that I am using ExplicitKey attribute on Id property. Like this how am I supposed to tell if it was successful or not ?
- Dominant language
- C#
- Stars
- 293
- Forks
- 109
- PR merge metrics
- No merged PRs in 30d
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.
More from DapperLib/Dapper.Contrib
-
Difficulty 1/5 Under an hour Newbie friendliness 75/100
DapperLib/Dapper.Contrib#22 · 2 comments ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 42/100
DapperLib/Dapper.Contrib#174 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 45/100
DapperLib/Dapper.Contrib#173 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 10/100
DapperLib/Dapper.Contrib#172 · 1 comment · 4 reactions ·
-
Difficulty 3/5 1-2 days Newbie friendliness 48/100
DapperLib/Dapper.Contrib#169 ·
All issues in DapperLib/Dapper.Contrib
Similar issues
-
type/automation type/tech-debt
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
t/bug
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
ci-failure-cause test-failure
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
area:auth FE mvp P3
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
klasolsson81/jobbliggaren#1788 ·