.NET | Persist multiple objects in minimum number of queries
- by VarunGupta
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?