How to add the data to DB within a 2 tables 1-N relation?

Certified Senior Developer

Hi,

When I have to add data within a 1-1 relation between 2 tables, I call the "Write to data store entity" Smart Service to add the new record in the parent table and then, from this component output, I retrieve the generated key Id, to set the Foreign Key in the child table.
How would you do for a 1-N relation?
Is there any way to add the data in the 2 tables (1 record in the parent table, and N records in the child table) in a simple way without doing any loop to set the FK ? 
What is the better way to do it please ?

  Discussion posts and replies are publicly visible