Hi, I'm trying to insert a new instance which have an association to another entity (many to one). First, the association dependancy is resolved with it's own repository (but the same context) and then attempt to save it calling this:
public void CreateOrUpdate(T instance)
{
if (instance == null)
throw new ArgumentNullException("instance");
Context.Set<T>().AddOrUpdate(instance);
Context.SaveChanges();
}
I always used the same implementation with earlier EF versions (from 4.4 to 6.1.0), now I'm using 6.1.1 and it is throwing "Violation of PRIMARY KEY constraint" attempting to reinsert resolved association entity.
Any help is appreciated.
Go to the complete details ...