You will need to set the "cascade" setting in the mappings. Take a look at the docs.
On Sun, Jun 28, 2009 at 11:52 AM, V <[email protected]> wrote: > > > > There is of course the option of not sending your actual domain > > > objects remotely, instead using simple parameters and/or DTOs and > > > letting your domain objects stay on the server side. > > > > And the sun the moon and the stars ? > > > > Oskar, your solution is for a mere mortal and I don't think is what the > CTO > > is looking for. > > ;) > > CTO does not know C# at all. CTO is CTO because he runs the company > and signs my pay cheque. All he wants is a promise of faster > development of our applications using WCF + WinForms / WPF. I have > already suggested using DTO's. I have created a small demo of WCF > service using Entity Framework where I pass some objects to and fro to > show various operations for insert, update and delete. Now I have to > create a WCF service using NH so that we can compare the two side-by- > side. > > The only thing I did not like about entity framework was that if a > parent is being updated along with some child objects in its > collection, I have to follow these steps: > > 1) insert -> add object to context (analogous to NH session) but going > through all the items in the list and adding only the items which are > new (by checking unassigned PK) > 2) delete -> I have to bring back a list of id's of items to be > deleted because they are missing from the parent collection due to > removal from list, and then use those id's to delete objects > indivdually. > 3) update -> this is more complex as every item that needs to be > updates must be loaded from the database into the context, updated > with new values and then persisted with method SaveChanges (from > framework itself) which issues update statement if any property has > changed from it original value from database. > > This is where we want to minimise coding. > > In my question I wanted to know was if I attach a parent to session > and save it, will it take care of updating child objects also by > attaching them to session and issuing proper statements for insert/ > update/delete? > > I will give it a try myself tomorrow, I was wondering if somebody else > had experience in this area and could guide me. > > Thanks > V > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "nhusers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/nhusers?hl=en -~----------~----~----~----~------~----~------~--~---
