How to use the default Entity Framework and default date values

后端 未结 8 833
说谎
说谎 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:35

    Create a partial class for your EntityObject, add a default constructor, and set default values in it.

        public partial class YourDBObject
        {
              public YourDBObject()
              {
                   this._DateField = DateTime.Now;
              }
        }
    

提交回复
热议问题