mirror of
				https://github.com/nsnail/FreeSql.git
				synced 2025-11-04 17:20:49 +08:00 
			
		
		
		
	This commit is contained in:
		@@ -1,12 +1,12 @@
 | 
			
		||||
using FreeSql.Internal;
 | 
			
		||||
using FreeSql.Internal.CommonProvider;
 | 
			
		||||
using FreeSql.Internal.Model;
 | 
			
		||||
using FreeSql.Internal.ObjectPool;
 | 
			
		||||
using System;
 | 
			
		||||
using System.Collections;
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
using System.Data.Common;
 | 
			
		||||
using System.Data.OscarClient;
 | 
			
		||||
using System.Text;
 | 
			
		||||
using System.Linq;
 | 
			
		||||
using System.Threading;
 | 
			
		||||
 | 
			
		||||
namespace FreeSql.ShenTong
 | 
			
		||||
@@ -24,16 +24,21 @@ namespace FreeSql.ShenTong
 | 
			
		||||
                MasterPool = pool;
 | 
			
		||||
                return;
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            var isAdoPool = masterConnectionString?.StartsWith("AdoConnectionPool,") ?? false;
 | 
			
		||||
            if (isAdoPool) masterConnectionString = masterConnectionString.Substring("AdoConnectionPool,".Length);
 | 
			
		||||
            if (!string.IsNullOrEmpty(masterConnectionString))
 | 
			
		||||
                MasterPool = new ShenTongConnectionPool(CoreStrings.S_MasterDatabase, masterConnectionString, null, null);
 | 
			
		||||
            if (slaveConnectionStrings != null)
 | 
			
		||||
                MasterPool = isAdoPool ?
 | 
			
		||||
                    new DbConnectionStringPool(base.DataType, CoreStrings.S_MasterDatabase, () => new OscarConnection(masterConnectionString)) as IObjectPool<DbConnection> :
 | 
			
		||||
                    new ShenTongConnectionPool(CoreStrings.S_MasterDatabase, masterConnectionString, null, null);
 | 
			
		||||
 | 
			
		||||
            slaveConnectionStrings?.ToList().ForEach(slaveConnectionString =>
 | 
			
		||||
            {
 | 
			
		||||
                foreach (var slaveConnectionString in slaveConnectionStrings)
 | 
			
		||||
                {
 | 
			
		||||
                    var slavePool = new ShenTongConnectionPool($"{CoreStrings.S_SlaveDatabase}{SlavePools.Count + 1}", slaveConnectionString, () => Interlocked.Decrement(ref slaveUnavailables), () => Interlocked.Increment(ref slaveUnavailables));
 | 
			
		||||
                    SlavePools.Add(slavePool);
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
                var slavePool = isAdoPool ?
 | 
			
		||||
                        new DbConnectionStringPool(base.DataType, $"{CoreStrings.S_SlaveDatabase}{SlavePools.Count + 1}", () => new OscarConnection(slaveConnectionString)) as IObjectPool<DbConnection> :
 | 
			
		||||
                        new ShenTongConnectionPool($"{CoreStrings.S_SlaveDatabase}{SlavePools.Count + 1}", slaveConnectionString, () => Interlocked.Decrement(ref slaveUnavailables), () => Interlocked.Increment(ref slaveUnavailables));
 | 
			
		||||
                SlavePools.Add(slavePool);
 | 
			
		||||
            });
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public override object AddslashesProcessParam(object param, Type mapType, ColumnInfo mapColumn)
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user