logo
0
0
WeChat Login
张鹏<scbeta@qq.com>
发布版本:2026.3.416

DbContextBackup

Backup and restore data from database with DbContext.

Prepare:

//Backup file format: d3b var backupContext = new DbContextBackup.D3b.D3bDbContextBackupContext( type => ModesJsonSerializerContext.Default2, (process, text) => Console.WriteLine($"[Progress][{process}%] {text}"), state => Console.WriteLine($"[State] {state}") ); //Backup file format: xlsx var backupContext = new DbContextBackup.Excel.XlsxDbContextBackupContext( type => ModesJsonSerializerContext.Default2, (process, text) => Console.WriteLine($"[Progress][{process}%] {text}"), state => Console.WriteLine($"[State] {state}") );

Backup:

using (var dbContext = new MyDbContext()) { backupContext.Backup(dbContext, backupFile); }

Restore:

using (var dbContext = new MyDbContext()) { backupContext.Restore(dbContext, backupFile); }

About

Backup and restore data from database with DbContext.

989.00 KiB
0 forks0 stars1 branches0 TagREADMEMIT license
Language
C#100%