'datetime2' error when using entity framework in VS 2010 .net 4.0

前端 未结 16 1252
半阙折子戏
半阙折子戏 2020-11-29 00:04

Getting this error:

System.Data.SqlClient.SqlException : The conversion of a datetime2 data type to a datetime data type resulted in an out-of-range v

16条回答
  •  死守一世寂寞
    2020-11-29 00:49

    Is there ModifiedTime property in your entity, which is updated on the database side only? If so, you must use DatabaseGeneratedOption.Computed (for EF CodeFirst). Also visit this https://stackoverflow.com/a/9508312/1317263

    Thank you.

提交回复
热议问题