Database default value is not inserted while create record by entity framework

前端 未结 3 1755
庸人自扰
庸人自扰 2021-02-15 17:33

I have a LoginRecord table in sqlserver 2008 with the following column structure-

LoginId      - int, identity
UserId       - int
LoginDateTime- Allow nulls fals         


        
3条回答
  •  抹茶落季
    2021-02-15 18:03

    Combined my two comments into an answer.

    Try setting the "StoredGeneratedPattern" attribute of your datetime in the EDMX file to Computed. From the following thread: http://www.stackoverflow.com/a/4688135/2488939

    To do this, go to the edmx file designer by clicking on your edmx file. Then locate your table and the property. Right-click the column in the table that you want to change and click on properties. The property window should then come up and you will see as one of the properties "StoredGeneratedPattern". Change that to computed.

提交回复
热议问题