I get the following error when I want to clone a line :
The property part of the object's key information and cannot be modified.
But I don't want to edit respective row but want to add it !
var parametersDisplay = db.utilisations_parametres_affichages.Where(o => o.utpar_clie_id == originalClientId).ToList();
foreach (var parameterDisplay in parametersDisplay)
{
parameterDisplay.utpar_clie_id = copyClientId;
parameterDisplay.utpar_user_update = "Backoffice";
db.utilisations_parametres_affichages.Add(parameterDisplay); // <== Exception
db.SaveChanges();
}
I have tried with EntityState.Added but it doesn't work too.
The table had two primary key, I want edit one only.
Edit : It's a composite key, with 2 fields