I am using EF6 code first approach, wherein i have class with CreatedDate field, i have decorated it with [DefaultValue("getutcdate()")]
and the Default binding has also been generated by EF, however, when i do not set any value for this field it sets as 0001-01-01 00:00:00.0000000
, but since i have setuped the default value for this field, ain't it should set the current datetime, instead of this value.
Here's my class which has CreatedDate field:
public class User
{
[DefaultValue("getutcdate()")]
public Datetime CreatedDate { get; set; }
}