mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-05-05 05:07:57 +08:00
Support aot
This commit is contained in:
parent
af6b2e808f
commit
2ac87a1423
@ -13,7 +13,7 @@ namespace SqlSugar
|
||||
/// <summary>
|
||||
///Connection unique code
|
||||
/// </summary>
|
||||
public dynamic ConfigId { get; set; }
|
||||
public object ConfigId { get; set; }
|
||||
/// <summary>
|
||||
///DbType.SqlServer Or Other
|
||||
/// </summary>
|
||||
|
@ -17,7 +17,7 @@ namespace SqlSugar
|
||||
Task BeginTranAsync(IsolationLevel iso);
|
||||
Task CommitTranAsync();
|
||||
Task RollbackTranAsync();
|
||||
void ChangeDatabase(dynamic configId);
|
||||
void ChangeDatabase(object configId);
|
||||
void ChangeDatabase(Func<ConnectionConfig, bool> changeExpression);
|
||||
SqlSugarTransaction UseTran();
|
||||
DbResult<bool> UseTran(Action action, Action<Exception> errorCallBack = null);
|
||||
@ -26,9 +26,9 @@ namespace SqlSugar
|
||||
|
||||
Task<DbResult<T>> UseTranAsync<T>(Func<Task<T>> action, Action<Exception> errorCallBack = null);
|
||||
void AddConnection(ConnectionConfig connection);
|
||||
SqlSugarProvider GetConnection(dynamic configId);
|
||||
void RemoveConnection(dynamic configId);
|
||||
SqlSugarScopeProvider GetConnectionScope(dynamic configId);
|
||||
SqlSugarProvider GetConnection(object configId);
|
||||
void RemoveConnection(object configId);
|
||||
SqlSugarScopeProvider GetConnectionScope(object configId);
|
||||
SqlSugarProvider GetConnectionWithAttr<T>();
|
||||
SqlSugarScopeProvider GetConnectionScopeWithAttr<T>();
|
||||
ISugarQueryable<T> QueryableWithAttr<T>();
|
||||
@ -41,7 +41,7 @@ namespace SqlSugar
|
||||
IDeleteable<T> DeleteableWithAttr<T>(List<T> deleteObjs) where T : class, new();
|
||||
IDeleteable<T> DeleteableWithAttr<T>() where T : class, new();
|
||||
|
||||
bool IsAnyConnection(dynamic configId);
|
||||
bool IsAnyConnection(object configId);
|
||||
|
||||
void Close();
|
||||
void Open();
|
||||
|
@ -903,13 +903,13 @@ namespace SqlSugar
|
||||
var configId = attr.configId;
|
||||
return this.GetConnectionScope(configId);
|
||||
}
|
||||
public SqlSugarProvider GetConnection(dynamic configId)
|
||||
public SqlSugarProvider GetConnection(object configId)
|
||||
{
|
||||
InitTenant();
|
||||
var db = this._AllClients.FirstOrDefault(it =>Convert.ToString(it.ConnectionConfig.ConfigId) ==Convert.ToString(configId));
|
||||
if (db == null)
|
||||
{
|
||||
Check.Exception(true, "ConfigId was not found {0}", configId);
|
||||
Check.Exception(true, "ConfigId was not found {0}", configId+"");
|
||||
}
|
||||
if (db.Context == null)
|
||||
{
|
||||
@ -932,24 +932,24 @@ namespace SqlSugar
|
||||
return db.Context;
|
||||
}
|
||||
|
||||
public SqlSugarScopeProvider GetConnectionScope(dynamic configId)
|
||||
public SqlSugarScopeProvider GetConnectionScope(object configId)
|
||||
{
|
||||
var conn = GetConnection(configId);
|
||||
return new SqlSugarScopeProvider(conn);
|
||||
}
|
||||
public bool IsAnyConnection(dynamic configId)
|
||||
public bool IsAnyConnection(object configId)
|
||||
{
|
||||
InitTenant();
|
||||
var db = this._AllClients.FirstOrDefault(it => Convert.ToString(it.ConnectionConfig.ConfigId) == Convert.ToString(configId));
|
||||
return db != null;
|
||||
|
||||
}
|
||||
public void ChangeDatabase(dynamic configId)
|
||||
public void ChangeDatabase(object configId)
|
||||
{
|
||||
configId =Convert.ToString(configId);
|
||||
var isLog = _Context.Ado.IsEnableLogEvent;
|
||||
Check.Exception(!_AllClients.Any(it =>Convert.ToString( it.ConnectionConfig.ConfigId) == configId), "ConfigId was not found {0}", configId);
|
||||
InitTenant(_AllClients.First(it => Convert.ToString(it.ConnectionConfig.ConfigId )== configId));
|
||||
Check.Exception(!_AllClients.Any(it =>Convert.ToString( it.ConnectionConfig.ConfigId) ==Convert.ToString( configId)), "ConfigId was not found {0}", configId+"");
|
||||
InitTenant(_AllClients.First(it => Convert.ToString(it.ConnectionConfig.ConfigId )==Convert.ToString( configId)));
|
||||
if (this._IsAllTran)
|
||||
this.Ado.BeginTran();
|
||||
if (this._IsOpen)
|
||||
|
@ -105,7 +105,7 @@ namespace SqlSugar
|
||||
{
|
||||
await ScopedContext.BeginTranAsync(iso);
|
||||
}
|
||||
public void ChangeDatabase(dynamic configId)
|
||||
public void ChangeDatabase(object configId)
|
||||
{
|
||||
ScopedContext.ChangeDatabase(configId);
|
||||
}
|
||||
@ -172,11 +172,11 @@ namespace SqlSugar
|
||||
ScopedContext.Dispose();
|
||||
}
|
||||
|
||||
public SqlSugarProvider GetConnection(dynamic configId)
|
||||
public SqlSugarProvider GetConnection(object configId)
|
||||
{
|
||||
return ScopedContext.GetConnection(configId);
|
||||
}
|
||||
public SqlSugarScopeProvider GetConnectionScope(dynamic configId)
|
||||
public SqlSugarScopeProvider GetConnectionScope(object configId)
|
||||
{
|
||||
return ScopedContext.GetConnectionScope(configId);
|
||||
}
|
||||
@ -733,7 +733,7 @@ namespace SqlSugar
|
||||
return ScopedContext.UseTranAsync(action, errorCallBack);
|
||||
}
|
||||
|
||||
public bool IsAnyConnection(dynamic configId)
|
||||
public bool IsAnyConnection(object configId)
|
||||
{
|
||||
return ScopedContext.IsAnyConnection(configId);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user