1 of 4

What's the best practice of inserting a collection of data into sql server database

I am using c#, entity framework. sql server for the development. I have a method which has two parameters (int ID, List _listobj). For each ID, there is a list of obj. All of these IDs and lists will be inserted into different tables in database. So the question is: what's the best practice for this? I have couple of options: 1) in c#, split the list as single value, then create a stored proc which takes two parameters (ID, str), then the c# will call the stored proc many times depending on the size of the list. 2) pass the ID and list as two parameters to the stored proc and let the stored proc to spit the list. This way the c# will only call the stored proc once. Is the second strategy doable? if yes, which is better in terms of performance? thanks!