Nullable DateTime and Dapper Dot Net

Viewed 2183

I have a Type with a nullable DateTime column. When I try to use Dapper Dot Net to create a collection of that Type, I run into problems.

Scenario 1: If all the rows are null for this column it's fine

Scenario 2: If one or more the rows have a date value for this column, I get the following error:

Error parsing column 3 (LastCompleted=2013-12-03 00:00:00 - DateTime) - Invalid cast from 'System.DateTime' to 'System.Nullable`1[[System.DateTime, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]'.

It's probably worth noting that I am using Dapper in a .NET 3.5 repository library - which seems to be fine, except for this issue.

If this is a known issue, then no problem, but I can't find anything specifically relating to Nullable DateTime in Dapper.

0 Answers
Related