using SqlSugar; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace DBBackupTool.Helpers; internal class SqlSugarHelper { public SqlSugarClient? Client; public bool Open(string connectionString, SqlSugar.DbType dbType, bool isAutoConnection) { if (this.Client is not null) return false; ConnectionConfig config = new() { ConnectionString = connectionString, DbType = dbType, IsAutoCloseConnection = isAutoConnection }; try { SqlSugarClient Db = new(config); this.Client = Db; } catch { return false; } return true; } public bool CreateTable(string database) { if (this.Client is null) return false; try { this.Client.DbMaintenance.CreateDatabase(database); } catch { return false; } return true; } }