@@ -60,14 +60,14 @@ public partial class PooledRedisClientManager
6060
6161 public IRedisClientFactory RedisClientFactory { get ; set ; }
6262
63- public long Db { get ; private set ; }
63+ public long ? Db { get ; private set ; }
6464
6565 public Action < IRedisNativeClient > ConnectionFilter { get ; set ; }
6666
6767 public PooledRedisClientManager ( ) : this ( RedisNativeClient . DefaultHost ) { }
6868
6969 public PooledRedisClientManager ( int poolSize , int poolTimeOutSeconds , params string [ ] readWriteHosts )
70- : this ( readWriteHosts , readWriteHosts , null , RedisNativeClient . DefaultDb , poolSize , poolTimeOutSeconds )
70+ : this ( readWriteHosts , readWriteHosts , null , null , poolSize , poolTimeOutSeconds )
7171 {
7272 }
7373
@@ -96,7 +96,7 @@ public PooledRedisClientManager(
9696 IEnumerable < string > readWriteHosts ,
9797 IEnumerable < string > readOnlyHosts ,
9898 RedisClientManagerConfig config )
99- : this ( readWriteHosts , readOnlyHosts , config , RedisNativeClient . DefaultDb , null , null )
99+ : this ( readWriteHosts , readOnlyHosts , config , null , null , null )
100100 {
101101 }
102102
@@ -112,12 +112,12 @@ public PooledRedisClientManager(
112112 IEnumerable < string > readWriteHosts ,
113113 IEnumerable < string > readOnlyHosts ,
114114 RedisClientManagerConfig config ,
115- long initalDb ,
115+ long ? initalDb ,
116116 int ? poolSizeMultiplier ,
117117 int ? poolTimeOutSeconds )
118118 {
119119 this . Db = config != null
120- ? config . DefaultDb . GetValueOrDefault ( initalDb )
120+ ? config . DefaultDb ?? initalDb
121121 : initalDb ;
122122
123123 ReadWriteHosts = readWriteHosts . ToRedisEndPoints ( ) ;
@@ -281,8 +281,8 @@ private void InitClient(RedisClient client)
281281 client . IdleTimeOutSecs = this . IdleTimeOutSecs . Value ;
282282 if ( this . NamespacePrefix != null )
283283 client . NamespacePrefix = NamespacePrefix ;
284- if ( client . Db != Db ) //Reset database to default if changed
285- client . ChangeDb ( Db ) ;
284+ if ( Db != null && client . Db != Db ) //Reset database to default if changed
285+ client . ChangeDb ( Db . Value ) ;
286286 }
287287
288288 /// <summary>
0 commit comments