ok, so I'm new to C # to do something, I'm from the ruby world.
I have a one-to-many relationship (parent for children for the sake of this question), and for some reason L2S wanted to create a new parent instead of using the one that already was. Here is the code.
Console.WriteLine(parent.Id);
foreach (string names in names)
{
Child new_child= new Child();
new_child.Parent = parent;
new_child.Name= name
db.CommitLogs.InsertOnSubmit(new_child);
db.SubmitChanges();
}
but if i just say
new_child.ParentId = parent.Id
which works great.
Can someone explain to me what is going on?
PS. The parent was found from the database using L2S. all keys, etc. configured correctly. Thank you for understanding.
source
share