mirror of
https://github.com/dotnetcore/FreeSql.git
synced 2026-03-19 04:20:56 +08:00
- 调整 resources 转换成 static class 静态类;#1917
This commit is contained in:
@@ -30,14 +30,14 @@ namespace FreeSql.Oracle
|
||||
if (isAdoPool) masterConnectionString = masterConnectionString.Substring("AdoConnectionPool,".Length);
|
||||
if (!string.IsNullOrEmpty(masterConnectionString))
|
||||
MasterPool = isAdoPool ?
|
||||
new DbConnectionStringPool(base.DataType, CoreStrings.S_MasterDatabase, () => OracleConnectionPool.CreateConnection(masterConnectionString)) as IObjectPool<DbConnection> :
|
||||
new OracleConnectionPool(CoreStrings.S_MasterDatabase, masterConnectionString, null, null);
|
||||
new DbConnectionStringPool(base.DataType, CoreErrorStrings.S_MasterDatabase, () => OracleConnectionPool.CreateConnection(masterConnectionString)) as IObjectPool<DbConnection> :
|
||||
new OracleConnectionPool(CoreErrorStrings.S_MasterDatabase, masterConnectionString, null, null);
|
||||
|
||||
slaveConnectionStrings?.ToList().ForEach(slaveConnectionString =>
|
||||
{
|
||||
var slavePool = isAdoPool ?
|
||||
new DbConnectionStringPool(base.DataType, $"{CoreStrings.S_SlaveDatabase}{SlavePools.Count + 1}", () => OracleConnectionPool.CreateConnection(slaveConnectionString)) as IObjectPool<DbConnection> :
|
||||
new OracleConnectionPool($"{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}", () => OracleConnectionPool.CreateConnection(slaveConnectionString)) as IObjectPool<DbConnection> :
|
||||
new OracleConnectionPool($"{CoreErrorStrings.S_SlaveDatabase}{SlavePools.Count + 1}", slaveConnectionString, () => Interlocked.Decrement(ref slaveUnavailables), () => Interlocked.Increment(ref slaveUnavailables));
|
||||
SlavePools.Add(slavePool);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -66,7 +66,7 @@ namespace FreeSql.Oracle
|
||||
{
|
||||
|
||||
internal OracleConnectionPool _pool;
|
||||
public string Name { get; set; } = $"Oracle Connection {CoreStrings.S_ObjectPool}";
|
||||
public string Name { get; set; } = $"Oracle Connection {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);
|
||||
@@ -141,8 +141,8 @@ namespace FreeSql.Oracle
|
||||
{
|
||||
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)
|
||||
@@ -171,8 +171,8 @@ namespace FreeSql.Oracle
|
||||
{
|
||||
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)
|
||||
|
||||
Reference in New Issue
Block a user