public static Task BulkInsertAsync <T>(this DbContext context, IList <T> entities, Action <BulkConfig> bulkAction, Action <decimal> progress = null) where T : class
        {
            BulkConfig bulkConfig = new BulkConfig();

            bulkAction?.Invoke(bulkConfig);
            return(DbContextBulkTransaction.ExecuteAsync(context, entities, OperationType.Insert, bulkConfig, progress));
        }
Exemple #2
0
        public static void BulkInsertOrUpdateOrDelete(this DbContext context, Type entityType, IList <object> entities, Action <BulkConfig> bulkAction, Action <decimal> progress = null)
        {
            BulkConfig bulkConfig = new BulkConfig();

            bulkAction?.Invoke(bulkConfig);
            DbContextBulkTransaction.Execute(context, entityType, entities, OperationType.InsertOrUpdateDelete, bulkConfig, progress);
        }
        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));
        }
        public static void BulkInsertOrUpdateOrDelete <T>(this DbContext context, IList <T> entities, Action <BulkConfig> bulkAction, Action <decimal> progress = null, Type type = null) where T : class
        {
            BulkConfig bulkConfig = new BulkConfig();

            bulkAction?.Invoke(bulkConfig);
            DbContextBulkTransaction.Execute(context, type, entities, OperationType.InsertOrUpdateDelete, bulkConfig, progress);
        }
        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);
        }
Exemple #6
0
        public static Task BulkDeleteAsync(this DbContext context, Type entityType, IList <object> entities, Action <BulkConfig> bulkAction, Action <decimal> progress = null, CancellationToken cancellationToken = default)
        {
            BulkConfig bulkConfig = new BulkConfig();

            bulkAction?.Invoke(bulkConfig);
            return(DbContextBulkTransaction.ExecuteAsync(context, entityType, entities, OperationType.Delete, bulkConfig, progress, cancellationToken));
        }
Exemple #7
0
        public static void BulkInsertAsync <T>(this DbContext context, IEnumerable <T> entities, Action <BulkConfig> bulkAction, Action <decimal> progress = null) where T : class
        {
            BulkConfig bulkConfig = new BulkConfig();

            bulkAction?.Invoke(bulkConfig);
            DbContextBulkTransaction.Execute(context, entities.ToList(), OperationType.Insert, bulkConfig, progress);
        }
        public static Task BulkUpdateAsync <TSource>(this DbContext context, IList <TSource> entities, List <string> updateProp, List <string> keyProp, Action <BulkConfig> bulkAction = null, CancellationToken cancellationToken = default) where TSource : class
        {
            BulkConfig bulkConfig = new BulkConfig();

            bulkConfig.UpdateByProperties  = keyProp;
            bulkConfig.PropertiesToInclude = updateProp;
            bulkAction?.Invoke(bulkConfig);
            return(DbContextBulkTransaction.ExecuteAsync(context, entities, OperationType.Update, bulkConfig, null, cancellationToken));
        }
        public static void BulkUpdate <TSource>(this DbContext context, IList <TSource> entities, List <string> updateProp, List <string> keyProp, Action <BulkConfig> bulkAction = null) where TSource : class
        {
            BulkConfig bulkConfig = new BulkConfig();

            bulkConfig.UpdateByProperties  = keyProp;
            bulkConfig.PropertiesToInclude = updateProp;
            bulkAction?.Invoke(bulkConfig);
            DbContextBulkTransaction.Execute(context, entities, OperationType.Update, bulkConfig, null);
        }
 public static void Truncate <T>(this DbContext context) where T : class
 {
     DbContextBulkTransaction.Execute <T>(context, new List <T>(), OperationType.Truncate, null, null);
 }
 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));
 }
Exemple #12
0
 public static void BulkUpdate(this DbContext context, Type entityType, IList <object> entities, BulkConfig bulkConfig = null, Action <decimal> progress = null)
 {
     DbContextBulkTransaction.Execute(context, entityType, entities, OperationType.Update, bulkConfig, progress);
 }
 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);
 }
Exemple #14
0
 public static void Truncate(this DbContext context, Type entityType)
 {
     DbContextBulkTransaction.Execute(context, entityType, new List <object>(), OperationType.Truncate, null, null);
 }
 public static void BulkInsert <T>(this DbContext context, IList <T> entities, BulkConfig bulkConfig = null) where T : class
 {
     DbContextBulkTransaction.Execute <T>(context, entities, OperationType.Insert, bulkConfig);
 }
Exemple #16
0
        // Async methods

        public static Task BulkInsertAsync <T>(this DbContext context, IEnumerable <T> entities, BulkConfig bulkConfig = null, Action <decimal> progress = null) where T : class
        {
            return(DbContextBulkTransaction.ExecuteAsync(context, entities.ToList(), OperationType.Insert, bulkConfig, progress));
        }
Exemple #17
0
 public static void BulkDelete <T>(this DbContext context, IEnumerable <T> entities, BulkConfig bulkConfig = null, Action <decimal> progress = null) where T : class
 {
     DbContextBulkTransaction.Execute(context, entities.ToList(), OperationType.Delete, bulkConfig, progress);
 }
        // 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));
        }
 public static Task BulkReadAsync <T>(this DbContext context, IList <T> entities, BulkConfig bulkConfig = null, Action <decimal> progress = null) where T : class
 {
     return(DbContextBulkTransaction.ExecuteAsync(context, entities, OperationType.Read, bulkConfig, progress));
 }
Exemple #20
0
 public static Task BulkReadAsync(this DbContext context, Type entityType, IList <object> entities, BulkConfig bulkConfig = null, Action <decimal> progress = null, CancellationToken cancellationToken = default)
 {
     return(DbContextBulkTransaction.ExecuteAsync(context, entityType, entities, OperationType.Read, bulkConfig, progress, cancellationToken));
 }
 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);
 }
        public static void BatchInsert <T>(this IQueryable query, IList <T> entities, BulkConfig bulkConfig = null) where T : class
        {
            var context = BatchUtil.GetDbContext(query);

            DbContextBulkTransaction.Execute(context, entities, OperationType.Insert, bulkConfig, null);
        }
Exemple #23
0
 public static Task TruncateAsync(this DbContext context, Type entityType, CancellationToken cancellationToken = default)
 {
     return(DbContextBulkTransaction.ExecuteAsync(context, entityType, new List <object>(), OperationType.Truncate, null, null, cancellationToken));
 }
Exemple #24
0
 public static Task BulkSaveChangesAsync(this DbContext context, BulkConfig bulkConfig = null, Action <decimal> progress = null, CancellationToken cancellationToken = default)
 {
     return(DbContextBulkTransaction.ExecuteAsync(context, typeof(object), new List <object>(), OperationType.SaveChanges, bulkConfig, progress, cancellationToken));
 }
        public static Task BatchInsertAsync <T>(this IQueryable query, IList <T> entities, BulkConfig bulkConfig = null, CancellationToken cancellationToken = default) where T : class
        {
            var context = BatchUtil.GetDbContext(query);

            return(DbContextBulkTransaction.ExecuteAsync(context, entities, OperationType.Insert, bulkConfig, null, cancellationToken));
        }
Exemple #26
0
 // SaveChanges methods
 #region SaveChanges
 public static void BulkSaveChanges(this DbContext context, BulkConfig bulkConfig = null, Action <decimal> progress = null)
 {
     DbContextBulkTransaction.Execute(context, typeof(object), new List <object>(), OperationType.SaveChanges, bulkConfig, progress);
 }