Entity Framework 6.2 - add children with DbSet.Include() but prevent duplicate children on DbSet.AddRange()
问题 EDIT: I know how to prevent duplicates when copying entities from one DbContext to another, my question is about their children. I have two contexts: DbContextHDD and DbContextUSB and they both contain a "Math" Course . DbContextHDD also contains: a "History" Course . a Student "Simon" who attends "Math" Course . a Student "Jack" who attends "History" Course . I would like to copy all Student entities from DbContextHDD to DbContextUSB and also include any Course entities not already present