I'm using generic repository pattern in asp.net core 2.0 which can not dispose repository object, when I am going to update the entry its updated for one time successfully but when I am trying to update for more then once it throws the following exception:
The instance of entity type 'Company' cannot be tracked because another instance with the same key value for {'ID'} is already being tracked. When attaching existing entities, ensure that only one entity instance with a given key value is attached. Consider using 'DbContextOptionsBuilder.EnableSensitiveDataLogging' to see the conflicting key values.
public ActionResult Edit(Int64 id, Company collection)
{
try
{
// TODO: Add update logic here
interfaceobj.updateModel(collection);
interfaceobj.Save();
return RedirectToAction(nameof(Index));
}
catch(Exception ex)
{
throw ex;
}
}