New Posts New Posts RSS Feed: SaveChangesAsync and associated entities
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

SaveChangesAsync and associated entities

 Post Reply Post Reply
Author
MVenhola View Drop Down
Newbie
Newbie


Joined: 20-Sep-2010
Posts: 8
Post Options Post Options   Quote MVenhola Quote  Post ReplyReply Direct Link To This Post Topic: SaveChangesAsync and associated entities
    Posted: 28-Jun-2011 at 8:11am
When passing an IEnumerable to SaveChangesAsync, are the associated entities saved as well?
 
ie:
 
A Project entity has an associated list of Contacts.
 
em.SaveChangesAsync(Projects, callback);
 
Are the Contacts saved as well?
Back to Top
sbelini View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 13-Aug-2010
Location: Oakland
Posts: 786
Post Options Post Options   Quote sbelini Quote  Post ReplyReply Direct Link To This Post Posted: 28-Jun-2011 at 8:56am
Hi MVenhola,
 
When you are doing a 'partial' save, only the entities passed on to the save are actually saved:
 
If you want to also save the contacts, you will need to pass them to the SaveChanges call.
 
In the DevForce Resource Center you will find an article on saving a graph of entities.
 
Regards,
   Silvio.
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down