i am trying to insert a row to a table with an identity column and three "normal" columns using entity framework in wpf. however i got this error message: Cannot insert explicit value for identity column in table 'MyTable' when IDENTITY_INSERT is set to OFF here is my code snippet, trying to add to the user table who has name, surname, age and userID(identity) column:
var newuser = new User();
newuser.SurName = surNameTextBox.Text;
newuser.Name = nameTextBox.Text;
newuser.Age = Int32.Parse(ageTextBox.Text);
context.AddToUsers(newuser);
context.SaveChanges();
can anyone help me on solving this problem? thanks in advance.