protected void btnCreateClassCode_Click(object sender, EventArgs e) { string connection = ConfigSugar.GetConfigString("connstring"); //这里可以动态根据cookies或session实现多库切换 var db = new SqlSugarClient(connection); txtResult.Value = db.ClassGenerating.SqlToClass(db, txtSql.Text, txtClassName.Text); db.Dispose(); }
protected void btnCreate_Click(object sender, EventArgs e) { string connection = ConfigSugar.GetConfigString("connstring"); //这里可以动态根据cookies或session实现多库切换 var db = new SqlSugarClient(connection);; db.ClassGenerating.CreateClassFiles(db, txtPath.Text, txtNS.Text); db.Dispose(); //还有其它方法我这边只是最简单的 //db.ClassGenerating.CreateClassFilesByTableNames //db.ClassGenerating.... }
//禁止实例化 public SugarDao() { string connection = ConfigSugar.GetConfigString("connstring"); //这里可以动态根据cookies或session实现多库切换 this.db = new SqlSugarClient(connection); }