Monday, 2 September 2013

Link records in two tables without extra SubmitChanges

Link records in two tables without extra SubmitChanges

Given two tables, where one is bound to another:
Items
SubItems
The Items table has an ID field with Identity Seed.
Here's the problem: to add SubItems to an Item, it's necessary to first
save the Item, so the ID is generated. An extra call to
DataContext.SubmitChanges is required before SubItems can be added and
submitted.
Is there any way to set up the identity to allow just a single
SubmitChanges call to save both the Item and SubItems at once?
One solution could be getting the IdentitySeed manually - but here is an
issue with multithreading.

No comments:

Post a Comment