- 调整 resources 转换成 static class 静态类;#1917

This commit is contained in:
2881099
2024-11-08 14:35:10 +08:00
parent fa0e5ba0e2
commit 01b9ae0076
228 changed files with 3538 additions and 4961 deletions

View File

@@ -32,7 +32,7 @@ namespace FreeSql.Firebird.Curd
string getMergeSql(List<T1> data)
{
if (_tempPrimarys.Any() == false) throw new Exception(CoreStrings.InsertOrUpdate_Must_Primary_Key(_table.CsName));
if (_tempPrimarys.Any() == false) throw new Exception(CoreErrorStrings.InsertOrUpdate_Must_Primary_Key(_table.CsName));
var tempPrimaryIsIdentity = _tempPrimarys.Any(b => b.Attribute.IsIdentity);
var sb = new StringBuilder().Append("MERGE INTO ").Append(_commonUtils.QuoteSqlName(TableRuleInvoke())).Append(" t1 \r\nUSING (");

View File

@@ -31,14 +31,14 @@ namespace FreeSql.Firebird
if (isAdoPool) masterConnectionString = masterConnectionString.Substring("AdoConnectionPool,".Length);
if (!string.IsNullOrEmpty(masterConnectionString))
MasterPool = isAdoPool ?
new DbConnectionStringPool(base.DataType, CoreStrings.S_MasterDatabase, () => new FbConnection(masterConnectionString)) as IObjectPool<DbConnection> :
new FirebirdConnectionPool(CoreStrings.S_MasterDatabase, masterConnectionString, null, null);
new DbConnectionStringPool(base.DataType, CoreErrorStrings.S_MasterDatabase, () => new FbConnection(masterConnectionString)) as IObjectPool<DbConnection> :
new FirebirdConnectionPool(CoreErrorStrings.S_MasterDatabase, masterConnectionString, null, null);
slaveConnectionStrings?.ToList().ForEach(slaveConnectionString =>
{
var slavePool = isAdoPool ?
new DbConnectionStringPool(base.DataType, $"{CoreStrings.S_SlaveDatabase}{SlavePools.Count + 1}", () => new FbConnection(slaveConnectionString)) as IObjectPool<DbConnection> :
new FirebirdConnectionPool($"{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 FbConnection(slaveConnectionString)) as IObjectPool<DbConnection> :
new FirebirdConnectionPool($"{CoreErrorStrings.S_SlaveDatabase}{SlavePools.Count + 1}", slaveConnectionString, () => Interlocked.Decrement(ref slaveUnavailables), () => Interlocked.Increment(ref slaveUnavailables));
SlavePools.Add(slavePool);
});
}

View File

@@ -40,7 +40,7 @@ namespace FreeSql.Firebird
{
internal FirebirdConnectionPool _pool;
public string Name { get; set; } = $"Firebird FbConnection {CoreStrings.S_ObjectPool}";
public string Name { get; set; } = $"Firebird FbConnection {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);
@@ -115,7 +115,7 @@ namespace FreeSql.Firebird
if (_pool.IsAvailable)
{
if (obj.Value == null)
throw new Exception(CoreStrings.S_ConnectionStringError_Check(this.Name));
throw new Exception(CoreErrorStrings.S_ConnectionStringError_Check(this.Name));
if (obj.Value.State != ConnectionState.Open)
obj.Value.Open();
@@ -130,7 +130,7 @@ namespace FreeSql.Firebird
if (_pool.IsAvailable)
{
if (obj.Value == null)
throw new Exception(CoreStrings.S_ConnectionStringError_Check(this.Name));
throw new Exception(CoreErrorStrings.S_ConnectionStringError_Check(this.Name));
if (obj.Value.State != ConnectionState.Open)
await obj.Value.OpenAsync();

View File

@@ -89,8 +89,8 @@ namespace FreeSql.Firebird
{
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 = tb.DbName;
var tboldname = tb.DbOldName; //旧表名
if (string.IsNullOrEmpty(obj.tableName) == false)

View File

@@ -241,7 +241,7 @@ namespace FreeSql.Firebird
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 解析出来是分开的