ok, so I new to the C# way of doing things, I come from the ruby world.
I have a one to many relationship, (parent to children for sake of this question), and for some reason L2S was wanting to create a new parent instead of using the one is already had. Here is the code.
Console.WriteLine(parent.Id); // this equals 1
foreach (string names in names)
{
Child new_child= new Child();
new_child.Parent = parent;//now parent.Id would equal the next in the sequence.
new_child.Name= name
db.CommitLogs.InsertOnSubmit(new_child);
db.SubmitChanges();
}
but if I just say
new_child.ParentId = parent.Id
that works just fine.
Can someone explain to me whats going on?
PS. Parent was found from the database using L2S. all the keys and such are set up properly. Thanks for any insight.