How to use the default Entity Framework and default date values

后端 未结 8 793
说谎
说谎 2020-12-15 23:53

In my SQL Server database schema I have a data table with a date field that contains a default value of

CONVERT(VARCHAR(10), GETDATE(), 111)
<
8条回答
  •  轮回少年
    2020-12-16 00:20

    I had a similar problem using RIA Services with the Entity Framework. I was not able to set the value in the default constructor on the client side because the entity classes that are generated there already have an empty default constructor.

    The solution that I used was to implement the OnCreated partial method for the entity on the client by setting the required default value.

提交回复
热议问题