How can I add default values to a property when saving using Code First EF4.1?

前端 未结 3 2176
夕颜
夕颜 2020-12-31 13:22

I started by creating some models like this:

public abstract class EditableBase
{
    public DateTime CreatedOn { get; set; }
    public DateTime ModifiedOn          


        
3条回答
  •  情话喂你
    2020-12-31 14:09

    Did consider the two options in this post where you do something on the setter (or constructor)?

    The default attribute solution seems a good one.

提交回复
热议问题