示例#1
0
 /// <summary>
 /// Update the existing rows in the table in an asynchronous way.
 /// </summary>
 /// <param name="entities">The list of data entity objects to be used for update.</param>
 /// <param name="batchSize">The batch size of the update operation.</param>
 /// <param name="fields">The mapping list of <see cref="Field"/> objects to be used.</param>
 /// <param name="hints">The table hints to be used.</param>
 /// <param name="transaction">The transaction to be used.</param>
 /// <param name="cancellationToken">The <see cref="CancellationToken"/> object to be used during the asynchronous operation.</param>
 /// <returns>The number of affected rows during the update process.</returns>
 public Task <int> UpdateAllAsync(IEnumerable <TEntity> entities,
                                  int batchSize = Constant.DefaultBatchOperationSize,
                                  IEnumerable <Field> fields = null,
                                  string hints = null,
                                  IDbTransaction transaction          = null,
                                  CancellationToken cancellationToken = default)
 {
     return(DbRepository.UpdateAllAsync <TEntity>(entities: entities,
                                                  batchSize: batchSize,
                                                  fields: fields,
                                                  hints: hints,
                                                  transaction: transaction,
                                                  cancellationToken: cancellationToken));
 }
示例#2
0
 /// <summary>
 /// Update the existing rows in the table in an aysnchronous way.
 /// </summary>
 /// <param name="tableName">The name of the target table to be used.</param>
 /// <param name="entities">The list of entity objects to be used for update.</param>
 /// <param name="qualifiers">The expression for the qualifier fields.</param>
 /// <param name="batchSize">The batch size of the update operation.</param>
 /// <param name="fields">The mapping list of <see cref="Field"/> objects to be used.</param>
 /// <param name="hints">The table hints to be used.</param>
 /// <param name="transaction">The transaction to be used.</param>
 /// <returns>The number of affected rows during the update process.</returns>
 public Task <int> UpdateAllAsync(string tableName,
                                  IEnumerable <TEntity> entities,
                                  Expression <Func <TEntity, object> > qualifiers,
                                  int batchSize = Constant.DefaultBatchOperationSize,
                                  IEnumerable <Field> fields = null,
                                  string hints = null,
                                  IDbTransaction transaction = null)
 {
     return(DbRepository.UpdateAllAsync <TEntity>(tableName: tableName,
                                                  entities: entities,
                                                  qualifiers: qualifiers,
                                                  batchSize: batchSize,
                                                  fields: fields,
                                                  hints: hints,
                                                  transaction: transaction));
 }