Skip to content

Let's make the type mapper more pluggable. #385

Description

@NickCraver

I'm seeing a big picture of a lot of issues solved in a single way here. People want to slightly adjust how the type mapping works in various ways - and I think we can do a better job of allowing this.

Here are some examples:

This one is a more questionable example (as in questionable if this would help):

There may be a few I missed, but you get the idea. You can replace the DefaultTypeMap since #110 was merged a few weeks ago. However, we can do better here by allowing DefaultTypeMap to be plugged a bit rather than clipboard inherited all over. We'd also need to look at what functionality could move down into it to be pluggable (such as column names).

I'm not arguing for this to all be in core - I honestly think it'd be a bad idea if all of it was. I think making it pluggable makes some of the odder cases, if common, appear as mappers you could easily plug in from contrib. For example, what if #376 could be fixed by:

SqlMapper.TypeMapProvider= t =>Dapper.Contrib.DataMemberMapper;

and #350 by:

SqlMapper.TypeMapProvider= t =>MyCustomMultiMapper;

Posting this here for thoughts.

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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions