mirror of
https://github.com/dotnetcore/FreeSql.git
synced 2026-02-23 08:40:56 +08:00
- 调整 resources 转换成 static class 静态类;#1917
This commit is contained in:
@@ -24,7 +24,7 @@ namespace FreeSql.KingbaseES
|
||||
public KingbaseESOnConflictDoUpdate(IInsert<T1> insert, Expression<Func<T1, object>> columns = null)
|
||||
{
|
||||
_insert = insert as KingbaseESInsert<T1>;
|
||||
if (_insert == null) throw new Exception(CoreStrings.S_Features_Unique("OnConflictDoUpdate", "KingbaseES"));
|
||||
if (_insert == null) throw new Exception(CoreErrorStrings.S_Features_Unique("OnConflictDoUpdate", "KingbaseES"));
|
||||
if (_insert._noneParameterFlag == "c") _insert._noneParameterFlag = "cu";
|
||||
|
||||
if (columns != null)
|
||||
@@ -38,7 +38,7 @@ namespace FreeSql.KingbaseES
|
||||
}
|
||||
if (_tempPrimarys == null || _tempPrimarys.Any() == false)
|
||||
_tempPrimarys = _insert.InternalTable.Primarys;
|
||||
if (_tempPrimarys.Any() == false) throw new Exception(CoreStrings.S_OnConflictDoUpdate_MustIsPrimary);
|
||||
if (_tempPrimarys.Any() == false) throw new Exception(CoreErrorStrings.S_OnConflictDoUpdate_MustIsPrimary);
|
||||
}
|
||||
|
||||
protected void ClearData()
|
||||
|
||||
@@ -32,14 +32,14 @@ namespace FreeSql.KingbaseES
|
||||
if (isAdoPool) masterConnectionString = masterConnectionString.Substring("AdoConnectionPool,".Length);
|
||||
if (!string.IsNullOrEmpty(masterConnectionString))
|
||||
MasterPool = isAdoPool ?
|
||||
new DbConnectionStringPool(base.DataType, CoreStrings.S_MasterDatabase, () => new KdbndpConnection(masterConnectionString)) as IObjectPool<DbConnection> :
|
||||
new KingbaseESConnectionPool(CoreStrings.S_MasterDatabase, masterConnectionString, null, null);
|
||||
new DbConnectionStringPool(base.DataType, CoreErrorStrings.S_MasterDatabase, () => new KdbndpConnection(masterConnectionString)) as IObjectPool<DbConnection> :
|
||||
new KingbaseESConnectionPool(CoreErrorStrings.S_MasterDatabase, masterConnectionString, null, null);
|
||||
|
||||
slaveConnectionStrings?.ToList().ForEach(slaveConnectionString =>
|
||||
{
|
||||
var slavePool = isAdoPool ?
|
||||
new DbConnectionStringPool(base.DataType, $"{CoreStrings.S_SlaveDatabase}{SlavePools.Count + 1}", () => new KdbndpConnection(slaveConnectionString)) as IObjectPool<DbConnection> :
|
||||
new KingbaseESConnectionPool($"{CoreStrings.S_SlaveDatabase}{SlavePools.Count + 1}", slaveConnectionString, () => Interlocked.Decrement(ref slaveUnavailables), () => Interlocked.Increment(ref slaveUnavailables));
|
||||
new DbConnectionStringPool(base.DataType, $"{CoreErrorStrings.S_SlaveDatabase}{SlavePools.Count + 1}", () => new KdbndpConnection(slaveConnectionString)) as IObjectPool<DbConnection> :
|
||||
new KingbaseESConnectionPool($"{CoreErrorStrings.S_SlaveDatabase}{SlavePools.Count + 1}", slaveConnectionString, () => Interlocked.Decrement(ref slaveUnavailables), () => Interlocked.Increment(ref slaveUnavailables));
|
||||
SlavePools.Add(slavePool);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -56,7 +56,7 @@ namespace FreeSql.KingbaseES
|
||||
{
|
||||
|
||||
internal KingbaseESConnectionPool _pool;
|
||||
public string Name { get; set; } = $"KingbaseES KdbndpConnection {CoreStrings.S_ObjectPool}";
|
||||
public string Name { get; set; } = $"KingbaseES KdbndpConnection {CoreErrorStrings.S_ObjectPool}";
|
||||
public int PoolSize { get; set; } = 100;
|
||||
public TimeSpan SyncGetTimeout { get; set; } = TimeSpan.FromSeconds(10);
|
||||
public TimeSpan IdleTimeout { get; set; } = TimeSpan.FromSeconds(20);
|
||||
@@ -131,8 +131,8 @@ namespace FreeSql.KingbaseES
|
||||
{
|
||||
if (obj.Value == null)
|
||||
{
|
||||
_pool.SetUnavailable(new Exception(CoreStrings.S_ConnectionStringError), obj.LastGetTimeCopy);
|
||||
throw new Exception(CoreStrings.S_ConnectionStringError_Check(this.Name));
|
||||
_pool.SetUnavailable(new Exception(CoreErrorStrings.S_ConnectionStringError), obj.LastGetTimeCopy);
|
||||
throw new Exception(CoreErrorStrings.S_ConnectionStringError_Check(this.Name));
|
||||
}
|
||||
|
||||
if (obj.Value.State != ConnectionState.Open || DateTime.Now.Subtract(obj.LastReturnTime).TotalSeconds > 60 && obj.Value.Ping() == false)
|
||||
@@ -161,8 +161,8 @@ namespace FreeSql.KingbaseES
|
||||
{
|
||||
if (obj.Value == null)
|
||||
{
|
||||
_pool.SetUnavailable(new Exception(CoreStrings.S_ConnectionStringError), obj.LastGetTimeCopy);
|
||||
throw new Exception(CoreStrings.S_ConnectionStringError_Check(this.Name));
|
||||
_pool.SetUnavailable(new Exception(CoreErrorStrings.S_ConnectionStringError), obj.LastGetTimeCopy);
|
||||
throw new Exception(CoreErrorStrings.S_ConnectionStringError_Check(this.Name));
|
||||
}
|
||||
|
||||
if (obj.Value.State != ConnectionState.Open || DateTime.Now.Subtract(obj.LastReturnTime).TotalSeconds > 60 && (await obj.Value.PingAsync()) == false)
|
||||
|
||||
@@ -152,8 +152,8 @@ namespace FreeSql.KingbaseES
|
||||
{
|
||||
if (sb.Length > 0) sb.Append("\r\n");
|
||||
var tb = obj.tableSchema;
|
||||
if (tb == null) throw new Exception(CoreStrings.S_Type_IsNot_Migrable(obj.tableSchema.Type.FullName));
|
||||
if (tb.Columns.Any() == false) throw new Exception(CoreStrings.S_Type_IsNot_Migrable_0Attributes(obj.tableSchema.Type.FullName));
|
||||
if (tb == null) throw new Exception(CoreErrorStrings.S_Type_IsNot_Migrable(obj.tableSchema.Type.FullName));
|
||||
if (tb.Columns.Any() == false) throw new Exception(CoreErrorStrings.S_Type_IsNot_Migrable_0Attributes(obj.tableSchema.Type.FullName));
|
||||
var tbname = _commonUtils.SplitTableName(tb.DbName);
|
||||
if (tbname?.Length == 1) tbname = new[] { public_, tbname[0] };
|
||||
|
||||
|
||||
@@ -369,7 +369,7 @@ namespace FreeSql.KingbaseES
|
||||
return _common.StringConcat(concatNewArrExp.Expressions.Select(a => getExp(a)).ToArray(), null);
|
||||
return _common.StringConcat(exp.Arguments.Select(a => getExp(a)).ToArray(), null);
|
||||
case "Format":
|
||||
if (exp.Arguments[0].NodeType != ExpressionType.Constant) throw new Exception(CoreStrings.Not_Implemented_Expression_ParameterUseConstant(exp, exp.Arguments[0]));
|
||||
if (exp.Arguments[0].NodeType != ExpressionType.Constant) throw new Exception(CoreErrorStrings.Not_Implemented_Expression_ParameterUseConstant(exp, exp.Arguments[0]));
|
||||
var expArgsHack = exp.Arguments.Count == 2 && exp.Arguments[1].NodeType == ExpressionType.NewArrayInit ?
|
||||
(exp.Arguments[1] as NewArrayExpression).Expressions : exp.Arguments.Where((a, z) => z > 0);
|
||||
//3个 {} 时,Arguments 解析出来是分开的
|
||||
|
||||
@@ -142,7 +142,7 @@ public static partial class FreeSqlKingbaseESGlobalExtensions
|
||||
public static void ExecuteKdbCopy<T>(this IInsert<T> that) where T : class
|
||||
{
|
||||
var insert = that as FreeSql.KingbaseES.KingbaseESInsert<T>;
|
||||
if (insert == null) throw new Exception(CoreStrings.S_Features_Unique("ExecuteKdbCopy", "KingbaseES"));
|
||||
if (insert == null) throw new Exception(CoreErrorStrings.S_Features_Unique("ExecuteKdbCopy", "KingbaseES"));
|
||||
|
||||
var dt = that.ToDataTable();
|
||||
if (dt.Rows.Count == 0) return;
|
||||
@@ -200,7 +200,7 @@ public static partial class FreeSqlKingbaseESGlobalExtensions
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new NotImplementedException($"ExecuteKdbCopy {CoreStrings.S_Not_Implemented_FeedBack}");
|
||||
throw new NotImplementedException($"ExecuteKdbCopy {CoreErrorStrings.S_Not_Implemented_FeedBack}");
|
||||
}
|
||||
}
|
||||
finally
|
||||
|
||||
Reference in New Issue
Block a user