Exemple #1
0
        public static Task BulkReadAsync <T>(this DbContext context, IList <T> entities, Action <BulkConfig> bulkAction, Action <decimal> progress = null, CancellationToken cancellationToken = default) where T : class
        {
            BulkConfig bulkConfig = new BulkConfig();

            bulkAction?.Invoke(bulkConfig);
            return(DbContextBulkTransaction.ExecuteAsync(context, entities, OperationType.Read, bulkConfig, progress, cancellationToken));
        }
Exemple #2
0
        // Async methods

        public static Task BulkInsertAsync <T>(this DbContext context, IList <T> entities, BulkConfig bulkConfig = null, Action <decimal> progress = null, CancellationToken cancellationToken = default) where T : class
        {
            return(DbContextBulkTransaction.ExecuteAsync(context, entities, OperationType.Insert, bulkConfig, progress, cancellationToken));
        }
Exemple #3
0
 public static Task TruncateAsync <T>(this DbContext context, CancellationToken cancellationToken = default) where T : class
 {
     return(DbContextBulkTransaction.ExecuteAsync <T>(context, new List <T>(), OperationType.Truncate, null, null, cancellationToken));
 }