I faced a similar problem, just put in the constructor of your entity a value for the attribute, the code follows.
public class Carton_Details
{
public DateTime DateOfSub { get; set; }
public Carton_Details()
{
this.DateOfSub = DateTime.Now;
}
}
I hope I helped.