I'm facing some issue with Entity Framework 5.0.
I have a WCF SOAP webservice with a method that create 2 entities in two mysql tables.
Entity B contains further informations to Entity A : so Entity A Primary Key is the same as Entity B PrimaryKey (like a Foreign Key).
When I create the whole entity (A+B), I don't have PK from Entity A used for entity B. So I need to save on context Entity A, then Entity B, then savechanges to commit.
taskDao.Save(task);
taskRenderingDao.Save(taskRendering);
taskDao.SaveChanges();
The problem is, when I have concurrent accesses, It happens that context is a bad state, and it returns me the following error : "unique constraint violating on PK".
Someone can help me to solve it ?
Thank you Guillaume.