I have a list of objects which needs to be persisted in a SQL Server database table, where each object gets persisted as single record. i.e. List of objects result in insertion of multiple records.
Trivial way of saving the objects is to loop over the list and fire a query/stored procedure/etc. for saving that record. But this results in multiple database interactions.
Is there a way to persist the list of objects in lesser number of database interactions?
Single stored proc with multiple XML (2005) or table valued (2008) parameters
This is what we do (2005)
The definitive articles from Erland Sommarskog for 2005 and 2008