On 22 Apr., 14:06, Anders <[email protected]> wrote: > > > > The generated Identifier is the unique key and used to associate > > > > children - do i have to update the children manually before the got > > > > inserted into the database? > > You shouldn't need to update the foreign keys in the child table, but > dblinq needs to be able to find the primary key in the parent table > (either because you assigned it, as in (1) above, or because it knows > the name of the sequence to query for the currval).
The primary key is found and set, but only - at my upper example - in one of the 2 children because there is another product object in the entitytrack ... > So who quries the sequences for the nextval in your system? > > > yes and no .. i observe a funny behaviour at the moment. i have the > > following structure: > > Report [1] -> [n] Product [1] -> [n] Component [1] -> [n] Interface > > > Each Entity has a column ID that references at the specific child > > entity. > > The ID of report is automatically used at the insert of Product, but > > all other IDs are not automatically used at their children to update > > them. So the data breaks ... > > So it seems to be because the children either didn't get an id or > dblinq couldn't retrieve the id of the parent. well both happens .. the id values are set in database and the objects, but the tracking seems to make a mistake ( or my data structure has an error ... ) > > Each ID-Column in the DBML is specified like: > > <Column Name="ID" Type="System.Int32" IsDbGenerated="true" > > IsPrimaryKey="true" AutoSync="OnInsert" CanBeNull="false" > > UpdateCheck="Always" Expression="S_INTERFACE.NextVal" /> > > Okay, so the expression seems to be corrent if you are using a trigger > to set column value. yes - before insert trigger ... > > Ok got it, but i obeserve following behaviour: i created 1 report with > > 150 products, 500 components and 900 interfaces. > > they are created like in your example ... but when i call > > Report.Products.Count the number 1 ... -> what? > > So you did get the products inserted? Was this products that you > inserted manually? > If you have a linq-query that returns a wrong result, I guess that is > a different matter. Could you give the complete linq-query and perhaps > the query being sent to the database? i did not insert something manually ... which queries do you want to get? i can mail you the dbml or cs code if it may help ... -- 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.
