Entity Framework - default values doesn't set in sql server table

前端 未结 4 1641
南方客
南方客 2020-11-30 12:32

SQL server 2005 database table has a column \'createdon\' for which default value set to getdate(). I am trying to add a record using entity framework. \'createdon\' column

4条回答
  •  半阙折子戏
    2020-11-30 13:18

    You can set StoreGeneratedPattern to Computed (as Malcolm suggested) in the GUI of the entity data model as well.

    1. Open your .edmx file in Visual Studio
    2. Open the properties of the field (click on the field -> hit F4 or right click->properties)
    3. Set StoreGeneratedPattern to Computed in the properties window as shown below:

提交回复
热议问题