Hallo,
I have the following class structure:
class Parent{
long Id{get;set;}
IList<Child> Children{get;set}
}
class Child{
long Id{get;set;}
}
If I'm doing somthing like this:
var parent = new Parent();
parent.Children.Add(new Child());
session.Save(parent);
session.Flush();
It will produce the insert for children at first with the referencing
id to the parent as null. Then it inserts the parent and then updates
the referencing id's in the children.
But why? The correct way should be insert the parent and then insert
the children and setting the id to the parent directly. Unlikly this
causes sometimes Problems in our database, becaus there are foreign
key constraints definded.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---