first off, i am new to programming.
i am trying making a program that uses many tasks. These tasks will insert data into multiple relational tables. (i am using sql server)
But, i think it is possible that there might be concurrency issues like, when a task inserts data into first table and uses last inserted identity id, in the other relational table, meanwhile the other task could insert a data into first table and change the last inserted identity id, so in that case, as the last inserted identity id changed, first task would use the wrong(changed by second task) last inserted identity id, i guess.
i thought to use serializable lock that locks the whole transaction, i gues that would work but this can also affect performance i guess.
So, what should i do without hurting the performance?