Exemplo n.º 1
0
 /// <summary>
 /// Merges the multiple dynamic objects into the database. By default, the database fields are used unless the 'fields' argument is defined.
 /// </summary>
 /// <param name="entities">The list of data entity objects to be merged.</param>
 /// <param name="batchSize">The batch size of the merge operation.</param>
 /// <param name="transaction">The transaction to be used.</param>
 /// <returns>The number of rows affected by the execution.</returns>
 public Task <int> MergeAllAsync(IEnumerable <TEntity> entities,
                                 int batchSize = Constant.DefaultBatchOperationSize,
                                 IDbTransaction transaction = null)
 {
     return(DbRepository.MergeAllAsync <TEntity>(entities: entities,
                                                 batchSize: batchSize,
                                                 transaction: transaction));
 }
Exemplo n.º 2
0
 /// <summary>
 /// Insert the multiple dynamic objects (as new rows) or update the existing rows in the table. This merge operation only works like upsert, it does not do any deletion. By default, the table fields are used unless the 'fields' argument is explicitly defined.
 /// </summary>
 /// <param name="entities">The list of entity objects to be merged.</param>
 /// <param name="qualifiers">The expression for the qualifer fields.</param>
 /// <param name="batchSize">The batch size of the merge operation.</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 merge process.</returns>
 public Task <int> MergeAllAsync(IEnumerable <TEntity> entities,
                                 Expression <Func <TEntity, object> > qualifiers,
                                 int batchSize = Constant.DefaultBatchOperationSize,
                                 string hints  = null,
                                 IDbTransaction transaction = null)
 {
     return(DbRepository.MergeAllAsync <TEntity>(entities: entities,
                                                 qualifiers: qualifiers,
                                                 batchSize: batchSize,
                                                 hints: hints,
                                                 transaction: transaction));
 }
Exemplo n.º 3
0
 /// <summary>
 /// Insert the multiple dynamic objects (as new rows) or update the existing rows in the table. By default, the table fields are used unless the 'fields' argument is explicitly defined.
 /// </summary>
 /// <param name="entities">The list of data entity objects to be merged.</param>
 /// <param name="batchSize">The batch size of the merge 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 merge process.</returns>
 public Task <int> MergeAllAsync(IEnumerable <TEntity> entities,
                                 int batchSize = Constant.DefaultBatchOperationSize,
                                 IEnumerable <Field> fields = null,
                                 string hints = null,
                                 IDbTransaction transaction          = null,
                                 CancellationToken cancellationToken = default)
 {
     return(DbRepository.MergeAllAsync <TEntity>(entities: entities,
                                                 batchSize: batchSize,
                                                 fields: fields,
                                                 hints: hints,
                                                 transaction: transaction,
                                                 cancellationToken: cancellationToken));
 }
Exemplo n.º 4
0
 /// <summary>
 /// Insert the multiple dynamic objects (as new rows) or update the existing rows in the table. By default, the table fields are used unless the 'fields' argument is explicitly defined.
 /// </summary>
 /// <param name="tableName">The name of the target table to be used.</param>
 /// <param name="entities">The list of data entity objects to be merged.</param>
 /// <param name="batchSize">The batch size of the merge 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 merge process.</returns>
 public Task <int> MergeAllAsync(string tableName,
                                 IEnumerable <TEntity> entities,
                                 int batchSize = Constant.DefaultBatchOperationSize,
                                 IEnumerable <Field> fields = null,
                                 string hints = null,
                                 IDbTransaction transaction = null)
 {
     return(DbRepository.MergeAllAsync <TEntity>(tableName: tableName,
                                                 entities: entities,
                                                 batchSize: batchSize,
                                                 fields: fields,
                                                 hints: hints,
                                                 transaction: transaction));
 }