Skip to content

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

Closed

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

  1. added 2 commits that reference this issue on Aug 31, 2018
  2. added a commit that references this issue on Sep 7, 2018
  3. added 2 commits that reference this issue on Jan 29, 2020
  4. added a commit that references this issue on Mar 13, 2024
    6e27740
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