Exemple #1
0
 /// <summary>
 /// Bulk insert a list of data entity objects into the database in an asynchronous way.
 /// </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 Task <int> BulkInsertAsync(IEnumerable <TEntity> entities,
                                   IEnumerable <BulkInsertMapItem> mappings = null,
                                   SqlBulkCopyOptions options = SqlBulkCopyOptions.Default,
                                   int?batchSize = null,
                                   IDbTransaction transaction = null)
 {
     return(DbRepository.BulkInsertAsync <TEntity>(entities: entities,
                                                   mappings: mappings,
                                                   options: options,
                                                   batchSize: batchSize,
                                                   transaction: transaction));
 }