Skip to content

SetValue is not invoked in a Dapper custom TypeHandler #607

@oS-So

Description

@oS-So

As per THIS question:

Given:

public class GuidHandler : SqlMapper.TypeHandler<Guid>
{
    public override void SetValue(IDbDataParameter parameter, Guid value)
    {
        // My Custom logic
    }

    public override Guid Parse(object value)
    {
        return Guid.Parse(value.ToString());
    }
}
...
SqlMapper.AddTypeHandler(new GuidHandler());

Even though the Parse is correctly invoked when reading from the DB, the SetValue however never gets called when writing the data.

Any idea of what is going on?

Metadata

Metadata

Assignees

No one assigned

    Labels

    breaking-changev3.0Changes awaiting the next breaking release

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions