Example #1
0
        public static void BulkRead <T>(this DbContext context, IList <T> entities, Action <BulkConfig> bulkAction, Action <decimal> progress = null) where T : class
        {
            BulkConfig bulkConfig = new BulkConfig();

            bulkAction?.Invoke(bulkConfig);
            DbContextBulkTransaction.Execute(context, entities, OperationType.Read, bulkConfig, progress);
        }
Example #2
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));
        }
Example #3
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));
        }
Example #4
0
 public static void Truncate <T>(this DbContext context) where T : class
 {
     DbContextBulkTransaction.Execute <T>(context, new List <T>(), OperationType.Truncate, null, null);
 }
Example #5
0
 public static void BulkRead <T>(this DbContext context, IList <T> entities, BulkConfig bulkConfig = null, Action <decimal> progress = null) where T : class
 {
     DbContextBulkTransaction.Execute(context, entities, OperationType.Read, bulkConfig, progress);
 }
Example #6
0
 public static void BulkInsertOrUpdateOrDelete <T>(this DbContext context, IList <T> entities, BulkConfig bulkConfig = null, Action <decimal> progress = null) where T : class
 {
     DbContextBulkTransaction.Execute(context, entities, OperationType.InsertOrUpdateDelete, bulkConfig, progress);
 }
Example #7
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));
 }