mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-05-17 13:39:33 +08:00
Synchronization code
This commit is contained in:
parent
a8da11a4b2
commit
74fc30ba80
@ -40,6 +40,7 @@ namespace SqlSugar
|
|||||||
public List<DbTableInfo> GetTableInfoList(Func<DbType,string, string> getChangeSqlFunc)
|
public List<DbTableInfo> GetTableInfoList(Func<DbType,string, string> getChangeSqlFunc)
|
||||||
{
|
{
|
||||||
var db=this.Context.CopyNew();
|
var db=this.Context.CopyNew();
|
||||||
|
db.CurrentConnectionConfig.IsAutoCloseConnection = true;
|
||||||
db.Aop.OnExecutingChangeSql = (sql, pars) =>
|
db.Aop.OnExecutingChangeSql = (sql, pars) =>
|
||||||
{
|
{
|
||||||
sql= getChangeSqlFunc(this.Context.CurrentConnectionConfig.DbType, sql);
|
sql= getChangeSqlFunc(this.Context.CurrentConnectionConfig.DbType, sql);
|
||||||
@ -66,6 +67,7 @@ namespace SqlSugar
|
|||||||
public List<DbColumnInfo> GetColumnInfosByTableName(string tableName, Func<DbType, string, string> getChangeSqlFunc)
|
public List<DbColumnInfo> GetColumnInfosByTableName(string tableName, Func<DbType, string, string> getChangeSqlFunc)
|
||||||
{
|
{
|
||||||
var db = this.Context.CopyNew();
|
var db = this.Context.CopyNew();
|
||||||
|
db.CurrentConnectionConfig.IsAutoCloseConnection = true;
|
||||||
db.Aop.OnExecutingChangeSql = (sql, pars) =>
|
db.Aop.OnExecutingChangeSql = (sql, pars) =>
|
||||||
{
|
{
|
||||||
sql = getChangeSqlFunc(this.Context.CurrentConnectionConfig.DbType, sql);
|
sql = getChangeSqlFunc(this.Context.CurrentConnectionConfig.DbType, sql);
|
||||||
|
@ -214,11 +214,15 @@ namespace SqlSugar
|
|||||||
this.Context.Ado.IsEnableLogEvent = false;
|
this.Context.Ado.IsEnableLogEvent = false;
|
||||||
foreach (var item in TableNames.GroupBy(it=>it.Key).Select(it=>it).ToDictionary(it=>it.Key,it=>it.First().Value))
|
foreach (var item in TableNames.GroupBy(it=>it.Key).Select(it=>it).ToDictionary(it=>it.Key,it=>it.First().Value))
|
||||||
{
|
{
|
||||||
if (!this.Context.CopyNew().DbMaintenance.IsAnyTable(item.Key, false))
|
var newDb = this.Context.CopyNew();
|
||||||
|
newDb.CurrentConnectionConfig.IsAutoCloseConnection = true;
|
||||||
|
if (!newDb.DbMaintenance.IsAnyTable(item.Key, false))
|
||||||
{
|
{
|
||||||
lock (SplitLockObj)
|
lock (SplitLockObj)
|
||||||
{
|
{
|
||||||
if (!this.Context.CopyNew().DbMaintenance.IsAnyTable(item.Key, false))
|
var newDb2 = this.Context.CopyNew();
|
||||||
|
newDb2.CurrentConnectionConfig.IsAutoCloseConnection = true;
|
||||||
|
if (!newDb2.DbMaintenance.IsAnyTable(item.Key, false))
|
||||||
{
|
{
|
||||||
if (item.Value != null)
|
if (item.Value != null)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user