Пример #1
0
 public SqlConnectionPoolManager(SqlConnectionPoolManagerOptions options)
 {
     _pools       = new ConcurrentDictionary <string, ConcurrentQueue <PooledDbConnectionWrapper> >();
     _connInfos   = new ConcurrentDictionary <Guid, ConnectionInfo>();
     _poolOptions = new ConcurrentDictionary <string, ConnectionPoolOptions>();
     _poolsLock   = new object();
     _options     = options;
 }
Пример #2
0
        public static IServiceCollection AddSqlConnectionPoolManager(this IServiceCollection services,
                                                                     out IDbConnectionPoolManager connPoolManager,
                                                                     Action <SqlConnectionPoolManagerOptions> configAction = null,
                                                                     Action <IDbConnectionPoolManager> initAction          = null)
        {
            var options = new SqlConnectionPoolManagerOptions();

            configAction?.Invoke(options);

            connPoolManager = new SqlConnectionPoolManager(options);
            initAction?.Invoke(connPoolManager);

            return(services.AddSingleton(connPoolManager));
        }