I understand what the error message is saying. I'm just not sure why it is saying it. My table has an Identity and it is set to auto-increment, yet when I go to save an entity I get the following error:
Cannot insert explicit value for identity column in table 'Conferences' when IDENTITY_INSERT is set to OFF.
I'm using a code-first approach and my Conference entity looks like this:
public class Conference
{
[Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int Id { get; set; }
public int DugoutId { get; set; }
public int ConferenceDetailsId { get; set; }
[ForeignKey("Id")]
public virtual Dugout Dugout { get; set; }
[ForeignKey("Id")]
public virtual ConferenceDetail ConferenceDetail { get; set; }
}
When I am going to save the Conference, the values are as follows:
Id: 0
DugoutId: 15
ConferenceDetailsId: 1
Dugout: null
ConferenceDetail: null
Any ideas why this won't save?