On 22 Apr., 12:56, mabu <[email protected]> wrote: > Some Code may help: > > Data.IMDataContext context = monitor.Context; > Data.Report report = new Data.Report() { SuiteID = 1, > Rundate = DateTime.Now }; > context.Reports.InsertOnSubmit(report); > Data.Product p = new Data.Product() { Report = report, > Name = "1" }; > context.Products.InsertOnSubmit(p); > Data.Component c = new Data.Component() { Product = p, > Name = "1-1" }; > context.Components.InsertOnSubmit(c); > Data.Component c2 = new Data.Component() { Product = > p, Name = "1-2" }; > context.Components.InsertOnSubmit(c2); > context.SubmitChanges(); > Console.WriteLine("report.ID=" + report.ID); > Console.WriteLine("p.ID=" + p.ID); > Console.WriteLine("c.ID=" + c.ID); > Console.WriteLine("c2.ID=" + c2.ID);
DataContext.CurrentTransactionEntities contains 4 entity tracks in the first step when GetReferencedObjects(entityTrack.Entity) is called. In the first loop run are already inserted 3 items ( objects report, p, c ) based on reports object ... they are inserted in the correct order and the ID in the objects is updated. At the next loop run ( object p ) trigges itself again and c again, net loop run triggers c again and fourth loop run triggers c2 So it seems that the lookup of the entityTracking does not work as I expected ... because the primary keys are set after inserting into database -- You received this message because you are subscribed to the Google Groups "DbLinq" 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/dblinq?hl=en.
