Dzoukr / Dapper.FSharp

Lightweight F# extension for StackOverflow Dapper with support for MSSQL, MySQL, PostgreSQL, and SQLite
MIT License
365 stars 35 forks source link

Sqlite and multiple type registration #78

Closed kaaja-h closed 1 year ago

kaaja-h commented 1 year ago

When using sqlite you have to register types using this way

OptionTypes.register ()
Dapper.FSharp.SQLite.TypeHandlers.addSQLiteTypeHandlers ()

but you register some type converter more than once. For example TimeSpan option I found that dapper sometime select convertor from OptionTypes.register() and sometime from addSQLiteTypeHandlers(). For example for TimeSpan it is problem, because convertor from OptionTypes.register() don't use TimeSpan.Parse and throws exception.

Dzoukr commented 1 year ago

Hi @kaaja-h, hmmm... I've never thought about it. Probably in the next version, I would have to add Type registration on the dbvendor-type level. Will look at it.

Dzoukr commented 1 year ago

Workaround, for now, is to create your own handlers function and not call the Dapper.FSharp ones

Dzoukr commented 1 year ago

Published in the new version - now there should be one registration per db vendor