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