I am working on a project that uses EF created with code first approach. The model was created by someone else. In the database table there was no primary key and all the fields were mandatory. Now we need a column to be auto incremented primary key and another column to be optional. We have made these changes in the database table but we are getting 'Entity Validation Error' since we are not passing the "ID"(probably the reason). What are the changes and where should they be written? Here is the class that was created:
public int ID { get; set; }//This needs to be auto incremented primary key.
public int UserID{ get; set; }
public string Name { get; set; }
public string Address { get; set; }
public bool IsActive { get; set; }
public bool Deleted { get; set; }
public int ModifiedBy { get; set; }
public System.DateTime DateCreated { get; set; }
public System.DateTime DateModified { get; set; }//This field needs to be optional.