What is a good method to insert table data that replies on many tables in C# and SQL server?
So for example say I have the following tables:
Products: PK=PID, Product_Name
Build: PK:BID, Build_Number, FK:PID
Files: PK:FID, File_Name, FK:PID
FileDetails: PK:FDID, FK:FID, FK:BID, File_Size, File_Version
So all the Primary Keys are auto incremented numbers
So I have an xml file, in there I have rows of information such as:
Product_Name ,Build_Number,File_Name,File_Size,File_Version
FooCreator1.0,112233 ,foo.exe ,123456 ,3.5
FooCreator1.0,112233 ,bar.exe ,234567 ,1.5
I want to be able to add the rows to my tables. Imagine my database is empty.
Do I first have to add all the products, then add all the builds, then add all the files, then join all the tables and then add all the file details?
EDIT: I will have around 20'000 rows and I will be storing around 40 values per line in the final unique table.