Explicit Constructor constructs the objects but doesn't pass correct values
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 18.4k
- Forks
- 3.7k
- Avg merge
- 5h 8m
- Merged PRs (30d)
- 1
Description
public class Area
{
[ExplicitConstructor]
public Area(int areaId)
{
AreaId = areaId;
}
public int AreaId {get;}
}
with sql resultset equivalent to:
{ INT AreaId = 7 }
and dapper code:
await reader.ReadAsync < Area >();
passes zero as the constructor parameter. It should pass 7
Strangely enough the eventual value is actually correct even though there is no setter on the property but because the value passed into the constructor is wrong I can't do parameter validation on it which is the reason for the constructor in the first place.
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
Reproduce the reported Area example with the ReadAsync() entry point and a result containing AreaId = 7. Trace the explicit-constructor mapping path to determine why zero is passed, then verify that the constructor receives 7 while the resulting property remains correct.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp, sql
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100