DapperLib / DapperLib/DapperAOT
Allow Dapper to enforce 'required' properties are present
Open
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 472
- Forks
- 43
- Avg merge
- 1d 4h
- Merged PRs (30d)
- 18
Description
I would be nice to be able to configure Dapper to respect 'required' annotations:
public class DataResult
{
public required string StringValue { get; set; }
public required int IntValue { get; set; }
}
...
await connectionQueryAsync<DataResult>("[proc_MyStoredProc]");
// Should throw an exception if `StringValue` or `IntValue` are not provided
Suggested API changes:
SqlMapper.Settings.RespectRequiredModifiers = true;
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 reviewing DapperAOT's configuration and the mapping path used by connectionQueryAsync. Define how the proposed SqlMapper.Settings.RespectRequiredModifiers setting should behave, then verify that missing required properties cause an exception while supplied properties continue to map successfully.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- databases
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100