Set default value in EF designer datetime

后端 未结 5 1682
终归单人心
终归单人心 2021-01-03 20:43

Trying to set the default value of a datetime field to take current time. In SQL\'s field designer i\'d use getdate(). What should i use in Entity Framework

5条回答
  •  情歌与酒
    2021-01-03 21:23

    Set 'StoredGeneratedPattern' to Computed against the field in the EDMX.

    You still need the default value in SQL Server though, the above setting will ensure EF honour's that.

提交回复
热议问题