예제 #1
0
파일: BulkInsert.cs 프로젝트: bank2u/RepoDb
 /// <summary>
 /// Bulk insert a list of data entity objects into the database.
 /// </summary>
 /// <param name="entities">The list of the data entities to be bulk-inserted.</param>
 /// <param name="mappings">The list of the columns to be used for mappings. If this parameter is not set, then all columns will be used for mapping.</param>
 /// <param name="options">The bulk-copy options to be used.</param>
 /// <param name="batchSize">The size per batch to be used.</param>
 /// <param name="transaction">The transaction to be used.</param>
 /// <returns>The number of rows affected by the execution.</returns>
 public int BulkInsert(IEnumerable <TEntity> entities,
                       IEnumerable <BulkInsertMapItem> mappings = null,
                       SqlBulkCopyOptions options = SqlBulkCopyOptions.Default,
                       int?batchSize = null,
                       IDbTransaction transaction = null)
 {
     return(DbRepository.BulkInsert <TEntity>(entities: entities,
                                              mappings: mappings,
                                              options: options,
                                              batchSize: batchSize,
                                              transaction: transaction));
 }