Inconsistent deserialisation between normal Query<T> and SqlMapper.Parse<T> · Issue #1111 · DapperLib/Dapper · GitHub
Skip to content

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

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>

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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