Closed jorismathijssen closed 2 years ago
Having two commands in my code, one to select the party and one to insert the order?
This is the way indeed. Dommel doesn't have a notion of entity relationships when it comes to inserting entities like Entity Framework for example has. The only way is to insert an Order
object with the (eg.) PartyId
foreign key set to a previously selected Party
.
I'm looking for advice for inserting a object with a one to one relation with a other table.
I have table [Parties], a table containing a Id (PK. auto increment) and a Name (varchar50) I also have a table [Orders], containing a Id (PK, not increment), Name (varchar50) and PartyId (relation with the other table)
What would be the best way to insert a new order into the orders table with a party that already exists in the parties table.
Having two commands in my code, one to select the party and one to insert the order? Or can this be combined?