I'm creating a simple table using EF6 and code first. All the fields are created except for the CreateDate
column. Why is that?
public class InspectionPoint
{
public DateTime CreateDate { get; }
public string Detail { get; set; }
public int Id { get; set; }
public bool IsActive { get; set; }
public string Name { get; set; }
public string Question { get; set; }
public DateTime UpdateDate { get; set; }
}
The UpdateDate
field is being created as expected but not the CreateDate
. Why is that?
I guess it's because that field is read-only, since it only has a getter:
public class InspectionPoint
{
// only has "get"ter - therefore it's readonly
public DateTime CreateDate { get; }
// Every other field has both "get" and "set" and can be set to new values
public string Detail { get; set; }
public int Id { get; set; }
public bool IsActive { get; set; }
public string Name { get; set; }
public string Question { get; set; }
public DateTime UpdateDate { get; set; }
}