Dapper-NodaTime icon indicating copy to clipboard operation
Dapper-NodaTime copied to clipboard

Nullable types not supported

Open lundmikkel opened this issue 6 years ago • 3 comments

When retrieving a nullable type, say Instant?, and the result from the database is actually null (System.DBNULL), an exception is thrown with the message "Cannot convert System.DBNULL to NodaTime.Instant".

It seems that in order to support nullable types, a new set of type handlers has to be added. I've forked the problem and made a proposal, which seems to work. It hasn't, however, been tested yet (couldn't quite figure the test setup), so I haven't made a PR just yet.

lundmikkel avatar Sep 20 '18 14:09 lundmikkel

It is possible to create a class with a nullable property and use that, but it seems excessive to have have to make a whole wrapper class just for a simple nullable value.

lundmikkel avatar Sep 25 '18 09:09 lundmikkel

It is possible to create a class with a nullable property and use that, but it seems excessive to have have to make a whole wrapper class just for a simple nullable value.

Hi @lundmikkel , I think this library is no longer maintained. Were you able to fix your issue completely? I mean, is there any other working alternative, or you just resorted on yours?

carlos0202 avatar Jan 14 '21 15:01 carlos0202

@carlos0202 Must admit I haven't used this for a long time. I'm not sure how I ended solving this, since it was in a previous job, where I don't have access to the code any longer. Sorry.

lundmikkel avatar Jan 15 '21 08:01 lundmikkel