mirror of
				https://github.com/nsnail/FreeSql.git
				synced 2025-11-04 17:20:49 +08:00 
			
		
		
		
	✨ support provider、Extensions Exceptions 多语言
This commit is contained in:
		@@ -29,12 +29,12 @@ namespace FreeSql.SqlServer
 | 
			
		||||
                return;
 | 
			
		||||
            }
 | 
			
		||||
            if (!string.IsNullOrEmpty(masterConnectionString))
 | 
			
		||||
                MasterPool = new SqlServerConnectionPool("主库", masterConnectionString, null, null);
 | 
			
		||||
                MasterPool = new SqlServerConnectionPool(CoreStrings.S_MasterDatabase, masterConnectionString, null, null);
 | 
			
		||||
            if (slaveConnectionStrings != null)
 | 
			
		||||
            {
 | 
			
		||||
                foreach (var slaveConnectionString in slaveConnectionStrings)
 | 
			
		||||
                {
 | 
			
		||||
                    var slavePool = new SqlServerConnectionPool($"从库{SlavePools.Count + 1}", slaveConnectionString, () => Interlocked.Decrement(ref slaveUnavailables), () => Interlocked.Increment(ref slaveUnavailables));
 | 
			
		||||
                    var slavePool = new SqlServerConnectionPool($"{CoreStrings.S_SlaveDatabase}{SlavePools.Count + 1}", slaveConnectionString, () => Interlocked.Decrement(ref slaveUnavailables), () => Interlocked.Increment(ref slaveUnavailables));
 | 
			
		||||
                    SlavePools.Add(slavePool);
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
 
 | 
			
		||||
@@ -49,7 +49,7 @@ namespace FreeSql.SqlServer
 | 
			
		||||
    {
 | 
			
		||||
 | 
			
		||||
        internal SqlServerConnectionPool _pool;
 | 
			
		||||
        public string Name { get; set; } = "SqlServer SqlConnection 对象池";
 | 
			
		||||
        public string Name { get; set; } = $"SqlServer SqlConnection {CoreStrings.S_ObjectPool}";
 | 
			
		||||
        public int PoolSize { get; set; } = 100;
 | 
			
		||||
        public TimeSpan SyncGetTimeout { get; set; } = TimeSpan.FromSeconds(10);
 | 
			
		||||
        public TimeSpan IdleTimeout { get; set; } = TimeSpan.FromSeconds(20);
 | 
			
		||||
@@ -126,8 +126,8 @@ namespace FreeSql.SqlServer
 | 
			
		||||
 | 
			
		||||
                if (obj.Value == null)
 | 
			
		||||
                {
 | 
			
		||||
                    _pool.SetUnavailable(new Exception("连接字符串错误"), obj.LastGetTimeCopy);
 | 
			
		||||
                    throw new Exception($"【{this.Name}】连接字符串错误,请检查。");
 | 
			
		||||
                    _pool.SetUnavailable(new Exception(CoreStrings.S_ConnectionStringError), obj.LastGetTimeCopy);
 | 
			
		||||
                    throw new Exception(CoreStrings.S_ConnectionStringError_Check(this.Name));
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
                if (obj.Value.State != ConnectionState.Open || DateTime.Now.Subtract(obj.LastReturnTime).TotalSeconds > 60 && obj.Value.Ping() == false)
 | 
			
		||||
@@ -156,8 +156,8 @@ namespace FreeSql.SqlServer
 | 
			
		||||
 | 
			
		||||
                if (obj.Value == null)
 | 
			
		||||
                {
 | 
			
		||||
                    _pool.SetUnavailable(new Exception("连接字符串错误"), obj.LastGetTimeCopy);
 | 
			
		||||
                    throw new Exception($"【{this.Name}】连接字符串错误,请检查。");
 | 
			
		||||
                    _pool.SetUnavailable(new Exception(CoreStrings.S_ConnectionStringError), obj.LastGetTimeCopy);
 | 
			
		||||
                    throw new Exception(CoreStrings.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