Set default value in EF designer datetime

后端 未结 5 1653
终归单人心
终归单人心 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:05

    Building upon RPM1984's answer:

    1. Select the field that has the default value,Created_On in my example, within your EDMX file
    2. Go to the Properties panel
    3. Select the StoreGeneratedPattern attribute
    4. Then change the value to Computed

    EDMX to Properties panel

提交回复
热议问题