C
C#12mo ago
moritz

Dapper enum to snake_case string

Hi, I have an enum ItemType with values like FileCollection. In the database a string is stored in snake_case form, eg. 'file_collection'. Dapper doesn't seem to map it automatically, even with DefaultTypeMap.MatchNamesWithUnderscores = true;. Anyone else had a problem like this before and can help?
1 Reply
moritz
moritzOP12mo ago
i also tried registering a type handler (SqlMapper.AddTypeHandler(typeof(ItemType), new EnumTypeHandler());), but according to the debugger no method of the type handler is ever being called Damn :/ 8 years of such a significant issue is kind sad
Want results from more Discord servers?
Add your server