Skip to content

Inconsistent deserialisation between normal Query<T> and SqlMapper.Parse<T> #1111

@davidglassborow

Description

@davidglassborow

When using SqlMapper.Parse to map a data reader, the logic is not the same as when Dapper is managing the reader itself.

In particular the logic in QueryImpl uses Convert.ChangeType to convert types as required.

When using SqlMapper.Parse, the Parse implementation does not apply the same conversion logic.

So SELECT 1 will be cast to bool using Query<bool> but will fail with invalid cast error using SqlMapper.Parse<bool>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions