Пример #1
0
 public static async Task ReadAsync <T>(DbContext context, Type type, IList <T> entities, TableInfo tableInfo, Action <decimal> progress, CancellationToken cancellationToken) where T : class
 {
     if (tableInfo.BulkConfig.UseTempDB) // dropTempTableIfExists
     {
         await context.Database.ExecuteSqlRawAsync(SqlQueryBuilder.DropTable(tableInfo.FullTempTableName, tableInfo.BulkConfig.UseTempDB), cancellationToken).ConfigureAwait(false);
     }
     var adapter = SqlAdaptersMapping.CreateBulkOperationsAdapter(context);
     await adapter.ReadAsync(context, type, entities, tableInfo, progress, cancellationToken);
 }
Пример #2
0
        public static void Read <T>(DbContext context, Type type, IList <T> entities, TableInfo tableInfo, Action <decimal> progress) where T : class
        {
            if (tableInfo.BulkConfig.UseTempDB) // dropTempTableIfExists
            {
                context.Database.ExecuteSqlRaw(SqlQueryBuilder.DropTable(tableInfo.FullTempTableName, tableInfo.BulkConfig.UseTempDB));
            }
            var adapter = SqlAdaptersMapping.CreateBulkOperationsAdapter(context);

            adapter.Read(context, type, entities, tableInfo, progress);
        }
Пример #3
0
 private static async Task MergeAsync <T>(DbContext context, Type type, IList <T> entities, TableInfo tableInfo, OperationType operationType, Action <decimal> progress, CancellationToken cancellationToken) where T : class
 {
     var adapter = SqlAdaptersMapping.CreateBulkOperationsAdapter(context);
     await adapter.MergeAsync(context, type, entities, tableInfo, (EFCore.BulkExtensions.OperationType) operationType, progress, cancellationToken);
 }
Пример #4
0
        private static void Merge <T>(DbContext context, Type type, IList <T> entities, TableInfo tableInfo, OperationType operationType, Action <decimal> progress) where T : class
        {
            var adapter = SqlAdaptersMapping.CreateBulkOperationsAdapter(context);

            adapter.Merge(context, type, entities, tableInfo, (EFCore.BulkExtensions.OperationType)operationType, progress);
        }
Пример #5
0
 private static async Task InsertAsync <T>(DbContext context, Type type, IList <T> entities, TableInfo tableInfo, Action <decimal> progress, CancellationToken cancellationToken)
 {
     var adapter = SqlAdaptersMapping.CreateBulkOperationsAdapter(context);
     await adapter.InsertAsync(context, type, entities, tableInfo, progress, cancellationToken);
 }
Пример #6
0
        private static void Insert <T>(DbContext context, Type type, IList <T> entities, TableInfo tableInfo, Action <decimal> progress)
        {
            var adapter = SqlAdaptersMapping.CreateBulkOperationsAdapter(context);

            adapter.Insert(context, type, entities, tableInfo, progress);
        }
Пример #7
0
 public static async Task TruncateAsync(DbContext context, TableInfo tableInfo, CancellationToken cancellationToken)
 {
     var adapter = SqlAdaptersMapping.CreateBulkOperationsAdapter(context);
     await adapter.TruncateAsync(context, tableInfo, cancellationToken);
 }
Пример #8
0
        public static void Truncate(DbContext context, TableInfo tableInfo)
        {
            var adapter = SqlAdaptersMapping.CreateBulkOperationsAdapter(context);

            adapter.Truncate(context, tableInfo);
        }