I have the following code:
Chart getChart = _db.Charts.SingleOrDefault(p => p.ChartID == chart.ChartID);
if (ModelState.IsValid)
{
getChart.MainChart = false;
_db.Charts.AddObject(getChart);
_db.SaveChanges();
So I want to duplicate the row. But I'm getting this error: An object with the same key already exists in the ObjectStateManager. The existing object is in the Modified state. An object can only be added to the ObjectStateManager again if it is in the added state.
What is the easiest way to change the Identity column to let met add this row. I don't want to create a new Chart because there is allot of columns in that table.
Kind Regards