SQLite TypeHandler not called
Open
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 18.4k
- Forks
- 3.7k
- Avg merge
- 5h 8m
- Merged PRs (30d)
- 1
Description
Used the following handler with SQL-Server, works as expected.
public class DateOnlyTypeHandler : SqlMapper.TypeHandler<DateOnly>
{
public override void SetValue(IDbDataParameter parameter, DateOnly date)
{
parameter.Value = date.ToString("yyyy-MM-dd");
}
public override DateOnly Parse(object value)
=> DateOnly.FromDateTime((DateTime)value);
}
Setup
internal class DapperOperation
{
private readonly IDbConnection _cn;
public DapperOperation()
{
_cn = new SqlConnection(ConnectionString());
SqlMapper.AddTypeHandler(new SqlDateOnlyTypeHandler());
}
Problem
Tried this with SQLite.Core with SQLiteConnection and neither SetValue nor Parse are executed which I learned by a) inspecting values sent to the database b) setting breakpoints.
- Dapper 2.1.44
- System.Data.SQLite.Core 1.0.118
- VS2022 17.9.2
- NET8
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 reproducing the report with SQLiteConnection and the DateOnlyTypeHandler registered through SqlMapper.AddTypeHandler. Trace SetValue and Parse while comparing the SQLite behavior with the reported SQL Server behavior; done means both handler callbacks are invoked as expected for SQLite.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp, sqlite
- Domain
- database
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100