DbLink support

This commit is contained in:
sunkaixuan 2023-05-11 19:24:49 +08:00
parent 7889c4b781
commit b1a1c3f487
3 changed files with 10 additions and 0 deletions

View File

@ -1188,6 +1188,11 @@ namespace SqlSugar
tableName = this.QueryBuilder.LambdaExpressions.DbMehtods.GetTableWithDataBase
(this.QueryBuilder.Builder.GetTranslationColumnName(dbName), this.QueryBuilder.Builder.GetTranslationColumnName(tableName));
}
var dbLinkName = this.Context.CurrentConnectionConfig.DbLinkName;
if (dbLinkName.HasValue())
{
tableName = dbLinkName+"."+this.QueryBuilder.Builder.GetTranslationColumnName(tableName);
}
return tableName;
}
protected string AppendSelect(List<EntityColumnInfo> entityColumnInfos,string sql, ReadOnlyCollection<ParameterExpression> parameters, List<EntityColumnInfo> columnsResult, int parameterIndex1)

View File

@ -23,6 +23,10 @@ namespace SqlSugar
/// </summary>
public string ConnectionString { get; set; }
/// <summary>
/// QueryableWithAttr queries go to DbLinkName, which is commonly used for cross-library queries
/// </summary>
public string DbLinkName { get; set; }
/// <summary>
/// true does not need to close the connection
/// </summary>
public bool IsAutoCloseConnection { get; set; }

View File

@ -237,6 +237,7 @@ namespace SqlSugar
},
ConnectionString = it.ConnectionString,
DbType = it.DbType,
DbLinkName= it.DbLinkName,
IndexSuffix = it.IndexSuffix,
InitKeyType = it.InitKeyType,
IsAutoCloseConnection = it.IsAutoCloseConnection,