升级到NHibernate版本4后,我们收到此错误:
SqlDateTime overflow. Must be between 1/1/1753 12:00:00 AM and 12/31/9999 11:59:59 PM.
有一些DateTime? POCO中的值为空值,因此我人为设置为System.DateTime.Now
并且错误仍然存在。
在映射文件中,日期如下:
<property name="ApprovedOn"/>
网上有一条建议添加NullableDateTimeType
,如此:
<property name="ApprovedOn" type="Nullables.NHibernate.NullableDateTimeType, Nullables.NHibernate" />
这会导致运行时错误:
NHibernate.MappingException: Could not determine type for: Nullables.NHibernate.NullableDateTimeType, Nullables.NHibernate, for columns: NHibernate.Mapping.Column(ApprovedOn)
在Visual Studio中,在项目的参考资料中,我看一下NHibernate,我没有看到&#34; nullable&#34;或者&#34; datetime&#34;。 NHibernate下的列表如下:
Antlr.Runtime
Anter.Runtime.Debug
......等等......
Remotion.Linq.Transformations
Remotion.Linq.Utilties
我需要做什么?