Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use TypeHandler for all types #433

Open
chilversc opened this issue Jan 6, 2016 · 6 comments
Open

Use TypeHandler for all types #433

chilversc opened this issue Jan 6, 2016 · 6 comments
Labels
v3.0 Changes awaiting the next breaking release
Milestone

Comments

@chilversc
Copy link
Contributor

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.

@vdaron
Copy link

vdaron commented Jan 6, 2016

+1

@NickCraver
Copy link
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.

@chilversc
Copy link
Contributor Author

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

@kwaclaw
Copy link

kwaclaw commented Sep 22, 2016

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

@NickCraver
Copy link
Member

Tagging for the v2 release.

@NickCraver NickCraver added the v3.0 Changes awaiting the next breaking release label Jan 28, 2017
@NickCraver NickCraver modified the milestone: v2.0 Jan 30, 2017
@vitidev
Copy link

vitidev commented Feb 24, 2019

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
Labels
v3.0 Changes awaiting the next breaking release
Projects
None yet
Development

No branches or pull requests

5 participants