Nullable DateTime and Dapper Dot Net

只愿长相守 提交于 2019-12-22 08:03:01

问题


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.

来源:https://stackoverflow.com/questions/20374732/nullable-datetime-and-dapper-dot-net

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!