SqlMapper.TypeHandler SetValue Function No Execute
Open
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 18.4k
- Forks
- 3.7k
- Avg merge
- 5h 8m
- Merged PRs (30d)
- 1
Description
Hello! We have a need. You need to give the string a default value when it is null. I rewrote "sqlmapper.typehandler" and found that SetValue was not executed
Here is my code:
/// <summary>
/// string type handler
/// </summary>
public class StringHandler : Dapper.SqlMapper.TypeHandler<string>
{
public override string Parse(object value)
{
return value?.ToString() ?? string.Empty;
}
public override void SetValue(IDbDataParameter parameter, string value)
{
parameter.Value = value ?? string.Empty;
}
}
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
No repository file or test is named in the issue. Start by reproducing the provided StringHandler with Dapper.SqlMapper.TypeHandler and trace parameter binding to determine why SetValue is not reached. Done means the reported null-string scenario is understood and covered by a regression test showing the expected parameter value.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp, sql
- Domain
- database
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100