Skip to content

Use TypeHandler for all types #433

Open

Description

@chilversc

Currently there is a separation between built-in types and custom types that use ITypeHandler.
There seems to be a common theme of bugs/enhancements that all revolve around this separation.

I was thinking its worth investigating if the type handling could be unified, so that both the in-built types and custom type handlers use the same mechanism so that the code handling types can be simplified in to, look up type handler, check for an optimizer, otherwise just use the type handler.

This would need to introduce a new enhanced type handler that can optionally generate IL to convert the to/from the database value. This would then allow custom type handlers to also generate optimized IL to convert the value.

This shouldn't have any significant impact on query times as type handlers are only looked up once when generating the IL for the query.

Activity

  1. vdaron commented on Jan 6, 2016

    @vdaron

    +1

  2. NickCraver commented on Feb 1, 2016

    @NickCraver
    Member

    I honestly don't know if I'm for or against this, I'll just note why we haven't dedicated much time to it: it's a potentially breaking change, so it'll have to wait for a 2.0 release.

    That being said, we're all for someone doing the digging on options as hours are the most limited resource around here - it'd be much appreciated.

  3. chilversc commented on Sep 21, 2016

    @chilversc
    ContributorAuthor

    Another case this could help with is #213 as it would allow the user to replace the in-built handling for strings.

  4. kwaclaw commented on Sep 22, 2016

    @kwaclaw

    Would also help with #303, #319, #471, #607.

  5. NickCraver commented on Jan 28, 2017

    @NickCraver
    Member

    Tagging for the v2 release.

  6. added
    v3.0
    on Jan 28, 2017
  7. modified the milestone: on Jan 30, 2017
  8. vitidev commented on Feb 24, 2019

    @vitidev

    And that's bad. Already 2019, but the problem is not solved.
    Does anyone understand why it is impossible to solve the problem with this pullrequest and by adding a flag like

    SqlMapper.OverrideHandlersForStandardTypes = true;

    so that the change is no longer breaking
    and not wait Dapper 2.0 for many years

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

    v3.0

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions