I was wondering if there's any way to achieve something like this using EF4:
I would like to do something like :
1. | 'Get Parent
2. | Dim Parent as oParent = mContext.GetParent(parentId)
3. |
4. | 'Link a child without loading it entirely, only using his ID
5. | oParent.Children.AddOnlyUsingChildId(aChildId) 'Or maybe EntityKey?
6. |
8. | 'Apply Changes (Save)
7. | mContext.SaveChanges()
All this because, I don't want to make a request to server each time to get whole child entity and anyway, I only have child's ID (comes from a checkboxlist). This is part a loop, in a loop and may have to load a hundreds of children for each first level loop. In my point of view, it is possible to do that as Entity Graph should know that when it comes the time to save the parent and N..N
relation, he should only insert 'Parrent.nId and Child.nId' in DB mapping table between child and parent... so it should not need entire child's graph.
Am I right? Is it possible?