sql server - Saving related data to the database via stored procedures -
i creating asp.net mvc 5 application , trying find out efficient way of saving related data sql server database. know entity framework easily, unfortunately using stored procedures in our application store , retrieve data database.that being said call sp's in out code via ef. cut story short, use sps in ef , not tables
i trying store request, services, worklog , activities data database. @ time storing 1 request. each request contain 1 or more services, activities or worklog. 1 service contain 1 or more activities or worklog. 1 activity contain 1 or more worklogs.
my initial thought first save request data , generate , requestid. pass request id services , on. issue approach there multiple postbacks.
i want minimise approach generating temporary ids , linking data. share working example , suggest better approach
generally, put in transaction rolls if there problem @ 1 step. insert parent table , use output clause id record , use id in inserts child tables. if company exclusively using stored procs, there must examples of how did other parent child relationships.
Comments
Post a Comment