Entity framework error: The conversion of a datetime2 data type to a datetime data

前端 未结 2 1314
不思量自难忘°
不思量自难忘° 2021-01-23 05:14

I know there are a ton of posts about this issue but none of them seem to solve my problem.

Here\'s the scenario:

I have a CreateDate Date

2条回答
  •  栀梦
    栀梦 (楼主)
    2021-01-23 06:15

    Have you tried setting the StoreGeneratedPattern attribute to 'Computed'. Failing that, as a last resort, try changing the column's datatype to datetime2.

    [The problem arises because the .NET DateTime.MinValue equals 0001-1-1 but Sql Server DateTime covers 1753-1-1 through 9999-12-31]

提交回复
热议问题