Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

NHibernate provides two ways to perform batch updates and inserts:

  1. AdoNetBatchSize: This property allows you to specify the number of SQL statements that will be executed in a batch before sending them to the database. By default, this property is set to 1, which means each SQL statement is executed individually. Increasing the AdoNetBatchSize can improve performance by reducing the number of round trips to the database.

  2. Batch insert/update/delete: This feature allows NHibernate to group multiple inserts, updates or deletes for the same entity type into a single SQL statement. This can improve performance by reducing the number of overall SQL statements executed. To use batch insert/update/delete, you need to set the batch-size attribute on the entity mapping or on the session factory configuration.

Both of these strategies can be used together to further improve performance.