DateTime列上的Mono InvalidOperationException(SQL Server)

时间:2015-07-19 09:38:20

标签: c# entity-framework datetime mono linq-to-entities

我无法将SQL Server中的DateTime2列映射到OS X上的Mono上的DateTime列。

created_at在sql端定义为DateTime2非可空列,我在c#侧定义为public DateTime created_at { get; set; }

我得到了这个例外:

InvalidOperationException: The 'created_at' property on 'revision' could not be set to a 'System.String' value. You must set this property to a non-null value of type 'System.DateTime'.

但是,在Windows上运行我的项目时,同样的定义也适用。

1 个答案:

答案 0 :(得分:0)

请尝试这个

public DateTime created_at { get; set; } 

它会帮助你......