Synchronization code

This commit is contained in:
sunkaixuan 2024-09-03 11:08:37 +08:00
parent 38c4499a52
commit 2cc582546f
13 changed files with 232 additions and 58 deletions

View File

@ -1577,9 +1577,20 @@ namespace SqlSugar
{ {
var tableinfo = this.QueryBuilder.AsTables.First(); var tableinfo = this.QueryBuilder.AsTables.First();
if (this.QueryBuilder.TableWithString != SqlWith.Null && this.Context.CurrentConnectionConfig?.MoreSettings?.IsWithNoLockQuery == true && this.QueryBuilder.AsTables.First().Value.ObjToString().Contains(SqlWith.NoLock) == false) if (this.QueryBuilder.TableWithString != SqlWith.Null && this.Context.CurrentConnectionConfig?.MoreSettings?.IsWithNoLockQuery == true && this.QueryBuilder.AsTables.First().Value.ObjToString().Contains(SqlWith.NoLock) == false)
{
if (this.QueryBuilder.AsTables.First().Value.EndsWith(") unionTable "))
{
this.QueryBuilder.AsTables[tableinfo.Key] = " (SELECT * FROM " + this.QueryBuilder.AsTables.First().Value + ")";
}
else if (this.QueryBuilder.AsTables.First().Value.EndsWith(") MergeTable "))
{
this.QueryBuilder.AsTables[tableinfo.Key] = " (SELECT * FROM " + this.QueryBuilder.AsTables.First().Value + ")";
}
else
{ {
this.QueryBuilder.AsTables[tableinfo.Key] = " (SELECT * FROM " + this.QueryBuilder.AsTables.First().Value + $" {SqlWith.NoLock} )"; this.QueryBuilder.AsTables[tableinfo.Key] = " (SELECT * FROM " + this.QueryBuilder.AsTables.First().Value + $" {SqlWith.NoLock} )";
} }
}
else if (this.QueryBuilder.IsSqlQuery && this.QueryBuilder.AsTables.First().Value.ObjToString().StartsWith("(")) else if (this.QueryBuilder.IsSqlQuery && this.QueryBuilder.AsTables.First().Value.ObjToString().StartsWith("("))
{ {
var tableName = this.QueryBuilder.AsTables.First().Value; var tableName = this.QueryBuilder.AsTables.First().Value;

View File

@ -1453,6 +1453,7 @@ namespace SqlSugar
return Select(expression); return Select(expression);
} }
var clone = this.Select(expression).Clone(); var clone = this.Select(expression).Clone();
clone.QueryBuilder.IsDistinct = false;
//clone.QueryBuilder.LambdaExpressions.Index = QueryBuilder.LambdaExpressions.Index+1; //clone.QueryBuilder.LambdaExpressions.Index = QueryBuilder.LambdaExpressions.Index+1;
var ps = clone.QueryBuilder; var ps = clone.QueryBuilder;
var sql = ps.GetSelectValue; var sql = ps.GetSelectValue;

View File

@ -176,6 +176,7 @@ namespace SqlSugar
builder.Replace(" OR ( AND", " OR ( "); builder.Replace(" OR ( AND", " OR ( ");
builder.Replace(" ( AND ", " ( "); builder.Replace(" ( AND ", " ( ");
builder.Replace(" ( OR ", " ( "); builder.Replace(" ( OR ", " ( ");
builder.Replace(" OR AND ", " OR ");
} }
} }
parameters.AddRange(childSqlInfo.Value); parameters.AddRange(childSqlInfo.Value);

View File

@ -27,6 +27,18 @@ namespace SqlSugar
foreach (var item in groupModels.GroupBy(it => it.GroupName)) foreach (var item in groupModels.GroupBy(it => it.GroupName))
{ {
var addList = item.Select(it => it.Item).ToList(); var addList = item.Select(it => it.Item).ToList();
if (IsVersion())
{
Check.ExceptionEasy(addList.Count > 1, "The version number can only be used for single record updates", "版本号只能用于单条记录更新");
result += this.Context.Updateable(addList.First())
.WhereColumns(this.WhereColumns?.ToArray())
.EnableDiffLogEventIF(this.IsEnableDiffLogEvent, this.BusinessData)
.UpdateColumns(updateobj.UpdateBuilder.UpdateColumns?.ToArray())
.IgnoreColumns(this.updateobj.UpdateBuilder.IsNoUpdateNull, this.updateobj.UpdateBuilder.IsOffIdentity, this.updateobj.UpdateBuilder.IsNoUpdateDefaultValue)
.IgnoreColumns(GetIgnoreColumns()).AS(item.Key).ExecuteCommandWithOptLock(isThrowError);
}
else
{
result += this.Context.Updateable(addList) result += this.Context.Updateable(addList)
.WhereColumns(this.WhereColumns?.ToArray()) .WhereColumns(this.WhereColumns?.ToArray())
.EnableDiffLogEventIF(this.IsEnableDiffLogEvent, this.BusinessData) .EnableDiffLogEventIF(this.IsEnableDiffLogEvent, this.BusinessData)
@ -34,6 +46,7 @@ namespace SqlSugar
.IgnoreColumns(this.updateobj.UpdateBuilder.IsNoUpdateNull, this.updateobj.UpdateBuilder.IsOffIdentity, this.updateobj.UpdateBuilder.IsNoUpdateDefaultValue) .IgnoreColumns(this.updateobj.UpdateBuilder.IsNoUpdateNull, this.updateobj.UpdateBuilder.IsOffIdentity, this.updateobj.UpdateBuilder.IsNoUpdateDefaultValue)
.IgnoreColumns(GetIgnoreColumns()).AS(item.Key).ExecuteCommandWithOptLock(isThrowError); .IgnoreColumns(GetIgnoreColumns()).AS(item.Key).ExecuteCommandWithOptLock(isThrowError);
} }
}
return result; return result;
} }
public int ExecuteCommand() public int ExecuteCommand()
@ -80,6 +93,19 @@ namespace SqlSugar
foreach (var item in groupModels.GroupBy(it => it.GroupName)) foreach (var item in groupModels.GroupBy(it => it.GroupName))
{ {
var addList = item.Select(it => it.Item).ToList(); var addList = item.Select(it => it.Item).ToList();
if (IsVersion())
{
Check.ExceptionEasy(addList.Count > 1, "The version number can only be used for single record updates", "版本号只能用于单条记录更新");
result += await this.Context.Updateable(addList.First())
.WhereColumns(this.WhereColumns?.ToArray())
.EnableDiffLogEventIF(this.IsEnableDiffLogEvent, this.BusinessData)
.UpdateColumns(updateobj.UpdateBuilder.UpdateColumns?.ToArray())
.IgnoreColumns(this.updateobj.UpdateBuilder.IsNoUpdateNull, this.updateobj.UpdateBuilder.IsOffIdentity, this.updateobj.UpdateBuilder.IsNoUpdateDefaultValue)
.IgnoreColumns(GetIgnoreColumns()).AS(item.Key).ExecuteCommandWithOptLockAsync(isThrowError);
}
else
{
result += await this.Context.Updateable(addList) result += await this.Context.Updateable(addList)
.WhereColumns(this.WhereColumns?.ToArray()) .WhereColumns(this.WhereColumns?.ToArray())
.EnableDiffLogEventIF(this.IsEnableDiffLogEvent, this.BusinessData) .EnableDiffLogEventIF(this.IsEnableDiffLogEvent, this.BusinessData)
@ -87,6 +113,7 @@ namespace SqlSugar
.IgnoreColumns(this.updateobj.UpdateBuilder.IsNoUpdateNull, this.updateobj.UpdateBuilder.IsOffIdentity, this.updateobj.UpdateBuilder.IsNoUpdateDefaultValue) .IgnoreColumns(this.updateobj.UpdateBuilder.IsNoUpdateNull, this.updateobj.UpdateBuilder.IsOffIdentity, this.updateobj.UpdateBuilder.IsNoUpdateDefaultValue)
.IgnoreColumns(GetIgnoreColumns()).AS(item.Key).ExecuteCommandWithOptLockAsync(isThrowError); .IgnoreColumns(GetIgnoreColumns()).AS(item.Key).ExecuteCommandWithOptLockAsync(isThrowError);
} }
}
return result; return result;
} }
private string [] GetIgnoreColumns() private string [] GetIgnoreColumns()
@ -117,6 +144,11 @@ namespace SqlSugar
} }
result = 0; result = 0;
} }
private bool IsVersion()
{
return this.Context.EntityMaintenance.GetEntityInfo<T>().Columns.Any(it => it.IsEnableUpdateVersionValidation);
}
internal class GroupModel internal class GroupModel
{ {
public string GroupName { get; set; } public string GroupName { get; set; }

View File

@ -98,6 +98,10 @@ namespace SqlSugar
} }
private bool UpdateObjectNotWhere() private bool UpdateObjectNotWhere()
{ {
if (this.Context?.CurrentConnectionConfig?.MoreSettings?.DatabaseModel == DbType.SqlServer)
{
return false;
}
return this.Context.CurrentConnectionConfig.DbType != DbType.MySql return this.Context.CurrentConnectionConfig.DbType != DbType.MySql
&& this.Context.CurrentConnectionConfig.DbType != DbType.MySqlConnector && this.Context.CurrentConnectionConfig.DbType != DbType.MySqlConnector
&& this.Context.CurrentConnectionConfig.DbType != DbType.SqlServer; && this.Context.CurrentConnectionConfig.DbType != DbType.SqlServer;
@ -294,6 +298,10 @@ namespace SqlSugar
private void DataChangesAop(T [] items) private void DataChangesAop(T [] items)
{ {
if (typeof(T).FullName.StartsWith("System.Collections.Generic.Dictionary`"))
{
return;
}
var dataEvent = this.Context.CurrentConnectionConfig.AopEvents?.DataChangesExecuted; var dataEvent = this.Context.CurrentConnectionConfig.AopEvents?.DataChangesExecuted;
if (dataEvent != null) if (dataEvent != null)
{ {

View File

@ -251,6 +251,22 @@ namespace SqlSugar
{ {
return new OracleUpdateable<T>(); return new OracleUpdateable<T>();
} }
else if (IsCustomDb(currentConnectionConfig))
{
var name =
"SqlSugar." + currentConnectionConfig.DbType +
"." + currentConnectionConfig.DbType
+ "Updateable`1";
var type = GetCustomTypeByClass<T>(name);
if (type == null)
{
return new UpdateableProvider<T>();
}
else
{
return (UpdateableProvider<T>)Activator.CreateInstance(type, true);
}
}
else else
{ {
return new UpdateableProvider<T>(); return new UpdateableProvider<T>();
@ -263,6 +279,22 @@ namespace SqlSugar
{ {
return new OracleDeleteable<T>(); return new OracleDeleteable<T>();
} }
else if (IsCustomDb(currentConnectionConfig))
{
var name =
"SqlSugar." + currentConnectionConfig.DbType +
"." + currentConnectionConfig.DbType
+ "Deleteable`1";
var type = GetCustomTypeByClass<T>(name);
if (type == null)
{
return new DeleteableProvider<T>();
}
else
{
return (DeleteableProvider<T>)Activator.CreateInstance(type, true);
}
}
else else
{ {
return new DeleteableProvider<T>(); return new DeleteableProvider<T>();

View File

@ -36,5 +36,6 @@ namespace SqlSugar
public static object DynamicExpressionParsingConfig; public static object DynamicExpressionParsingConfig;
public static Action<ICacheService, string> CacheRemoveByLikeStringFunc { get; set; } public static Action<ICacheService, string> CacheRemoveByLikeStringFunc { get; set; }
public static Guid TableQuerySqlKey { get; set; } public static Guid TableQuerySqlKey { get; set; }
public static string BulkCopy_MySqlCsvPath { get; set; }
} }
} }

View File

@ -26,7 +26,9 @@ namespace SqlSugar
IUpdateable<T> AsUpdateable(); IUpdateable<T> AsUpdateable();
IUpdateable<T> AsUpdateable(T[] updateObjs); IUpdateable<T> AsUpdateable(T[] updateObjs);
int Count(Expression<Func<T, bool>> whereExpression); int Count(Expression<Func<T, bool>> whereExpression);
int Count(List<IConditionalModel> conditionalModels);
bool Delete(Expression<Func<T, bool>> whereExpression); bool Delete(Expression<Func<T, bool>> whereExpression);
bool Delete(List<IConditionalModel> conditionalModels);
bool Delete(T deleteObj); bool Delete(T deleteObj);
bool Delete(List<T> deleteObjs); bool Delete(List<T> deleteObjs);
bool DeleteById(dynamic id); bool DeleteById(dynamic id);
@ -34,12 +36,20 @@ namespace SqlSugar
T GetById(dynamic id); T GetById(dynamic id);
List<T> GetList(); List<T> GetList();
List<T> GetList(Expression<Func<T, bool>> whereExpression); List<T> GetList(Expression<Func<T, bool>> whereExpression);
List<T> GetList(List<IConditionalModel> conditionalList);
List<T> GetList(Expression<Func<T, bool>> whereExpression, List<OrderByModel> orderByModels);
List<T> GetList(List<IConditionalModel> conditionalList, List<OrderByModel> orderByModels);
List<T> GetPageList(Expression<Func<T, bool>> whereExpression, PageModel page); List<T> GetPageList(Expression<Func<T, bool>> whereExpression, PageModel page);
List<T> GetPageList(Expression<Func<T, bool>> whereExpression, PageModel page, List<OrderByModel> orderByModels);
List<T> GetPageList(Expression<Func<T, bool>> whereExpression, PageModel page, Expression<Func<T, object>> orderByExpression = null, OrderByType orderByType = OrderByType.Asc); List<T> GetPageList(Expression<Func<T, bool>> whereExpression, PageModel page, Expression<Func<T, object>> orderByExpression = null, OrderByType orderByType = OrderByType.Asc);
List<T> GetPageList(List<IConditionalModel> conditionalList, PageModel page); List<T> GetPageList(List<IConditionalModel> conditionalList, PageModel page);
List<T> GetPageList(List<IConditionalModel> conditionalList, PageModel page, List<OrderByModel> orderByModels);
List<T> GetPageList(List<IConditionalModel> conditionalList, PageModel page, Expression<Func<T, object>> orderByExpression = null, OrderByType orderByType = OrderByType.Asc); List<T> GetPageList(List<IConditionalModel> conditionalList, PageModel page, Expression<Func<T, object>> orderByExpression = null, OrderByType orderByType = OrderByType.Asc);
T GetSingle(Expression<Func<T, bool>> whereExpression); T GetSingle(Expression<Func<T, bool>> whereExpression);
T GetSingle(List<IConditionalModel> conditionalModels);
T GetFirst(Expression<Func<T, bool>> whereExpression); T GetFirst(Expression<Func<T, bool>> whereExpression);
T GetFirst(List<IConditionalModel> conditionalModels);
T GetFirst(List<IConditionalModel> conditionalModels, List<OrderByModel> orderByModels);
bool Insert(T insertObj); bool Insert(T insertObj);
bool InsertOrUpdate(T data); bool InsertOrUpdate(T data);
bool InsertOrUpdate(List<T> datas); bool InsertOrUpdate(List<T> datas);
@ -53,6 +63,7 @@ namespace SqlSugar
bool IsAny(Expression<Func<T, bool>> whereExpression); bool IsAny(Expression<Func<T, bool>> whereExpression);
bool IsAny(List<IConditionalModel> conditionalModels);
bool Update(Expression<Func<T, T>> columns, Expression<Func<T, bool>> whereExpression); bool Update(Expression<Func<T, T>> columns, Expression<Func<T, bool>> whereExpression);
bool UpdateSetColumnsTrue(Expression<Func<T, T>> columns, Expression<Func<T, bool>> whereExpression); bool UpdateSetColumnsTrue(Expression<Func<T, T>> columns, Expression<Func<T, bool>> whereExpression);
bool Update(T updateObj); bool Update(T updateObj);

View File

@ -9,6 +9,7 @@ namespace SqlSugar
{ {
public interface ITenant public interface ITenant
{ {
string[] GetCurrentConfigIds();
void BeginTran(); void BeginTran();
void BeginTran(IsolationLevel iso); void BeginTran(IsolationLevel iso);
void CommitTran(); void CommitTran();

View File

@ -13,7 +13,7 @@ namespace SqlSugar
{ {
private static bool IsJoin(string name) private static bool IsJoin(string name)
{ {
return name.StartsWith("LeftJoin".ToLower()) || name.StartsWith("RightJoin".ToLower()) || name.StartsWith("InnertJoin".ToLower()); return name.StartsWith("LeftJoin".ToLower()) || name.StartsWith("RightJoin".ToLower()) || name.StartsWith("InnerJoin".ToLower());
} }
private static bool IsJoinLastAfter(string name) private static bool IsJoinLastAfter(string name)
{ {

View File

@ -13,9 +13,9 @@ namespace SqlSugar
public partial class SimpleClient<T> : ISugarRepository, ISimpleClient<T> where T : class, new() public partial class SimpleClient<T> : ISugarRepository, ISimpleClient<T> where T : class, new()
{ {
#region Interface #region Interface
public ISqlSugarClient Context { get; set; } public virtual ISqlSugarClient Context { get; set; }
public ITenant AsTenant() public virtual ITenant AsTenant()
{ {
var result = this.Context as ITenant; var result = this.Context as ITenant;
if (result == null && this.Context is SqlSugarProvider) if (result == null && this.Context is SqlSugarProvider)
@ -28,7 +28,7 @@ namespace SqlSugar
} }
return result; return result;
} }
public ISqlSugarClient AsSugarClient() public virtual ISqlSugarClient AsSugarClient()
{ {
return this.Context; return this.Context;
} }
@ -51,7 +51,7 @@ namespace SqlSugar
sm.Context = this.Context.CopyNew(); sm.Context = this.Context.CopyNew();
return sm; return sm;
} }
public RepositoryType CopyNew<RepositoryType>() where RepositoryType : ISugarRepository public virtual RepositoryType CopyNew<RepositoryType>() where RepositoryType : ISugarRepository
{ {
Type type = typeof(RepositoryType); Type type = typeof(RepositoryType);
var isAnyParamter = type.GetConstructors().Any(z => z.GetParameters().Any()); var isAnyParamter = type.GetConstructors().Any(z => z.GetParameters().Any());
@ -77,7 +77,7 @@ namespace SqlSugar
} }
return result; return result;
} }
public RepositoryType CopyNew<RepositoryType>(IServiceProvider serviceProvider) where RepositoryType : ISugarRepository public virtual RepositoryType CopyNew<RepositoryType>(IServiceProvider serviceProvider) where RepositoryType : ISugarRepository
{ {
var instance = handleDependencies(typeof(RepositoryType), serviceProvider, true); var instance = handleDependencies(typeof(RepositoryType), serviceProvider, true);
return (RepositoryType)instance; return (RepositoryType)instance;
@ -169,7 +169,7 @@ namespace SqlSugar
} }
return false; return false;
} }
public RepositoryType ChangeRepository<RepositoryType>() where RepositoryType : ISugarRepository public virtual RepositoryType ChangeRepository<RepositoryType>() where RepositoryType : ISugarRepository
{ {
Type type = typeof(RepositoryType); Type type = typeof(RepositoryType);
var isAnyParamter = type.GetConstructors().Any(z => z.GetParameters().Any()); var isAnyParamter = type.GetConstructors().Any(z => z.GetParameters().Any());
@ -189,44 +189,44 @@ namespace SqlSugar
} }
return result; return result;
} }
public RepositoryType ChangeRepository<RepositoryType>(IServiceProvider serviceProvider) where RepositoryType : ISugarRepository public virtual RepositoryType ChangeRepository<RepositoryType>(IServiceProvider serviceProvider) where RepositoryType : ISugarRepository
{ {
var instance = handleDependencies(typeof(RepositoryType), serviceProvider, false); var instance = handleDependencies(typeof(RepositoryType), serviceProvider, false);
return (RepositoryType)instance; return (RepositoryType)instance;
} }
public ISugarQueryable<T> AsQueryable() public virtual ISugarQueryable<T> AsQueryable()
{ {
return Context.Queryable<T>(); return Context.Queryable<T>();
} }
public IInsertable<T> AsInsertable(T insertObj) public virtual IInsertable<T> AsInsertable(T insertObj)
{ {
return Context.Insertable<T>(insertObj); return Context.Insertable<T>(insertObj);
} }
public IInsertable<T> AsInsertable(T[] insertObjs) public virtual IInsertable<T> AsInsertable(T[] insertObjs)
{ {
return Context.Insertable<T>(insertObjs); return Context.Insertable<T>(insertObjs);
} }
public IInsertable<T> AsInsertable(List<T> insertObjs) public virtual IInsertable<T> AsInsertable(List<T> insertObjs)
{ {
return Context.Insertable<T>(insertObjs); return Context.Insertable<T>(insertObjs);
} }
public IUpdateable<T> AsUpdateable(T updateObj) public virtual IUpdateable<T> AsUpdateable(T updateObj)
{ {
return Context.Updateable<T>(updateObj); return Context.Updateable<T>(updateObj);
} }
public IUpdateable<T> AsUpdateable(T[] updateObjs) public virtual IUpdateable<T> AsUpdateable(T[] updateObjs)
{ {
return Context.Updateable<T>(updateObjs); return Context.Updateable<T>(updateObjs);
} }
public IUpdateable<T> AsUpdateable(List<T> updateObjs) public virtual IUpdateable<T> AsUpdateable(List<T> updateObjs)
{ {
return Context.Updateable<T>(updateObjs); return Context.Updateable<T>(updateObjs);
} }
public IUpdateable<T> AsUpdateable() public virtual IUpdateable<T> AsUpdateable()
{ {
return Context.Updateable<T>(); return Context.Updateable<T>();
} }
public IDeleteable<T> AsDeleteable() public virtual IDeleteable<T> AsDeleteable()
{ {
return Context.Deleteable<T>(); return Context.Deleteable<T>();
} }
@ -691,6 +691,73 @@ namespace SqlSugar
this.Context.Ado.CancellationToken = cancellationToken; this.Context.Ado.CancellationToken = cancellationToken;
return await this.Context.Deleteable<T>().In(ids).ExecuteCommandAsync() > 0; return await this.Context.Deleteable<T>().In(ids).ExecuteCommandAsync() > 0;
} }
public int Count(List<IConditionalModel> conditionalModels)
{
return Context.Queryable<T>().Where(conditionalModels).Count();
}
public bool Delete(List<IConditionalModel> conditionalModels)
{
return Context.Deleteable<T>().Where(conditionalModels).ExecuteCommandHasChange();
}
public List<T> GetList(Expression<Func<T, bool>> whereExpression, List<OrderByModel> orderByModels)
{
return Context.Queryable<T>().Where(whereExpression).OrderBy(orderByModels).ToList();
}
public List<T> GetList(List<IConditionalModel> conditionalList)
{
return Context.Queryable<T>().Where(conditionalList).ToList();
}
public List<T> GetList(List<IConditionalModel> conditionalList, List<OrderByModel> orderByModels)
{
return Context.Queryable<T>().Where(conditionalList).OrderBy(orderByModels).ToList();
}
public List<T> GetPageList(Expression<Func<T, bool>> whereExpression, PageModel page, List<OrderByModel> orderByModels)
{
var total = 0;
var list = Context.Queryable<T>().Where(whereExpression).OrderBy(orderByModels).ToPageList(page.PageIndex, page.PageSize, ref total);
page.TotalCount = total;
return list;
}
public List<T> GetPageList(List<IConditionalModel> conditionalList, PageModel page, List<OrderByModel> orderByModels)
{
var total = 0;
var list = Context.Queryable<T>().Where(conditionalList).OrderBy(orderByModels).ToPageList(page.PageIndex, page.PageSize, ref total);
page.TotalCount = total;
return list;
}
public T GetSingle(List<IConditionalModel> conditionalModels)
{
return Context.Queryable<T>().Where(conditionalModels).Single();
}
public T GetFirst(List<IConditionalModel> conditionalModels)
{
return Context.Queryable<T>().Where(conditionalModels).First();
}
public bool IsAny(List<IConditionalModel> conditionalModels)
{
return Context.Queryable<T>().Where(conditionalModels).Any();
}
public T GetFirst(Expression<Func<T, bool>> whereExpression, List<OrderByModel> orderByModels)
{
return Context.Queryable<T>().Where(whereExpression).OrderBy(orderByModels).First();
}
public T GetFirst(List<IConditionalModel> conditionalModels, List<OrderByModel> orderByModels)
{
return Context.Queryable<T>().Where(conditionalModels).OrderBy(orderByModels).First();
}
#endregion #endregion
} }

View File

@ -9,6 +9,7 @@ using System.Reflection;
using System.Text; using System.Text;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Xml.Schema;
namespace SqlSugar namespace SqlSugar
{ {
@ -842,6 +843,10 @@ namespace SqlSugar
#endregion #endregion
#region More api #region More api
public string[] GetCurrentConfigIds()
{
return _AllClients.Select(it=>it.ConnectionConfig.ConfigId+string.Empty).ToArray();
}
public IContextMethods Utilities { get { return this.Context.Utilities; } set { this.Context.Utilities = value; } } public IContextMethods Utilities { get { return this.Context.Utilities; } set { this.Context.Utilities = value; } }
public AopProvider Aop => this.Context.Aop; public AopProvider Aop => this.Context.Aop;
public ICodeFirst CodeFirst => this.Context.CodeFirst; public ICodeFirst CodeFirst => this.Context.CodeFirst;

View File

@ -917,5 +917,9 @@ namespace SqlSugar
{ {
ScopedContext.ClearTracking(); ScopedContext.ClearTracking();
} }
public string[] GetCurrentConfigIds()
{
return ScopedContext.GetCurrentConfigIds();
}
} }
} }