I am currently writing a billing application using EF 5 Code First and I am running an error when starting the application.
The database object in question is as follows:
[Table("Client")]
public class ClientBase
{
[Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int ClientID { get; set; }
[Required]
public string ClientName { get; set; }
[Required]
public bool IsActive { get; set; }
[Required]
public string ClientContactName { get; set; }
[Required]
public string ClientContactEmail { get; set; }
[Required]
public DateTime ClientStartDate { get; set; }
[Required]
public string SalesforceID { get; set; }
public DateTime TerminatedDate { get; set; }
public string ClientStreet { get; set; }
public string ClientCity { get; set; }
public string ClientState { get; set; }
public int? ClientZipCode { get; set; }
public virtual List<PropertyBase> Properties { get; set; }
public virtual List<ClientCharge> ClientDefaultCharges { get; set; }
}
I recently added a bunch of these fields (from ClientStartDate to ClientZipCode all new), and whenever I launch the application, I get the following error:
{"Invalid column name 'ClientStartDate'.\r\nInvalid column name 'SalesforceID'.\r\nInvalid column name 'TerminatedDate'.\r\nInvalid column name 'ClientStreet'.\r\nInvalid column name 'ClientCity'.\r\nInvalid column name 'ClientState'.\r\nInvalid column name 'ClientZipCode'."}
What amazes me is that my database has really been updated. These fields are now on the table, but it still gives me an error.
Any ideas on what's going wrong here?
EDIT: Well, I obviously forgot to mention: SalesforceID is NOT a foreign key. None of the columns that were added were actually FK. These are just fields.