Files
Dapper/global.json
Andi 2a8faab235 Fix/prefer typehandlers for enums (#2200)
* Add Settings.PreferTypeHandlersForEnums opt-in flag

When enabled, Dapper checks for a registered TypeHandler for enum types
before falling back to the default integer boxing behavior. This allows
custom enum serialization (e.g. storing enums as strings via TypeHandlers)
to work on both reads and writes.

Patched locations:
- LookupDbType: return DbType.Object with handler when flag is on
- CreateParamInfoGenerator: skip integer boxing when handler exists
- GetSimpleValueDeserializer: route to TypeHandler before Enum.ToObject
- Parse<T>: route to TypeHandler before Enum.ToObject

Default is false — zero behavior change for existing users.

* Patch IL-emitted type deserializer and add tests

- Fix 6th enum-before-handler location in GetTypeDeserializer IL emit,
  preserving Nullable<T> wrapping for nullable enum properties
- Fix em-dash in comment (non-ASCII)
- Add two tests: round-trip write+read via StringEnumHandler, and
  nullable enum with null value

* Update SDK version from 10.0.102 to 8.0.100

* Update global.json

we have fixed the CI glitch separately

---------

Co-authored-by: Marc Gravell <marc.gravell@gmail.com>
2026-05-16 21:08:03 +01:00

7 lines
79 B
JSON

{
"sdk": {
"version": "10.0.102",
"rollForward": "latestMajor"
}
}