Use TypeHandler for all types
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 18.4k
- Forks
- 3.7k
- Avg merge
- 5h 8m
- Merged PRs (30d)
- 1
Description
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.
- #206 TypeHandler<> can't override default typeMap for base types
- #275 TypeHandler not working correctly with DynamicParameters
- #259 Custom type handlers for enums are ignored
- #224 Non-nullable TypeHandler passed DBNull when selecting scalar results
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.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing ITypeHandler and the separate built-in type-handling paths, then review linked issues #206, #275, #259, and #224. Done means built-in and custom types use a unified handler lookup, with optional optimized IL conversion available to custom handlers without regressing the reported cases.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- database
- Issue type
- Refactor
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100