Hi! I just wonder if it is my misunderstanding of Linq usage or if
it's really a lacking in DbLinq.

I am using DbLinq 0.20.1 with MySql and run into a situation, say I
want to insert 1 row with 2 columns each referencing 2 parent tables.

e.g.

Parent Table: Table_A, Table_B.
Child Table: Table_C, with Column_A_ID reference to Table_A, and
Column_B_ID reference table_B.

Now when I insert a new row into Table_C, obviously I am going to
execute Table_C.InsertOnSubmit(), if that row was referencing to an
existing entry in BOTH Table_A and Table_B, then things are fine.
However, if both Table_A and Table_B lacks that entry, then DbLinq
will bug me not conforming to the foreign key relationship. However,
If I create a row in the parent table, say Table_A, then insert the
row into Table_C, then it bugs me about constraint on Table_B, same
for inserting to Table_B first, then it bugs me about the constraint
on Table_A. I am wonder if I'd done something wrong, or DbLinq cannot
insert rows with more than 1 references.

e.g.
Dim context = New MyDbContext()
Dim table_a = New Table_A()
Dim table_b = New Table_B()
Dim table_c = New Table_C()
table_c.Table_A = table_a
table_c.Table_B = table_b

context.Table_C.InsertOnSubmit(table_c)  ''Not working after
SubmitChanges due to constraint of Table_A
context.Table_A.InsertOnSubmit(table_a)  'Not working after
SubmitChanges due to constraint of Table_B
context.Table_B.InsertOnSubmit(table_b)  'Not working after
SubmitChanges due to constraint of Table_A

so how exactly do I do it in DbLinq if I want to make 3 entries, 1
child and 2 parent with the child referencing both parents.

Thanks.

-- 
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.

Reply via email to