Struct DbConnectionFactoryExtensions.ConnectionFactoryToPoolAdapter<TConnection>
- Namespace
- Open.Database.Extensions
- Assembly
- Open.Database.Extensions.Core.dll
Presents a typed connection factory function as an IDbConnectionPool<TConnection>: taking a connection invokes the function and giving it back disposes it.
public readonly struct DbConnectionFactoryExtensions.ConnectionFactoryToPoolAdapter<TConnection> : IDbConnectionPool<TConnection>, IDbConnectionPool where TConnection : IDbConnection
Type Parameters
TConnectionThe connection type.
- Implements
-
IDbConnectionPool<TConnection>
- Inherited Members
- Extension Methods
Remarks
Nothing is pooled. This adapter lets code written against IDbConnectionPool<TConnection> accept a plain factory.
Constructors
- ConnectionFactoryToPoolAdapter(IDbConnectionFactory<TConnection>)
Constructs a DbConnectionFactoryExtensions.ConnectionFactoryToPoolAdapter<TConnection> from a typed connection factory.
- ConnectionFactoryToPoolAdapter(Func<TConnection>)
Presents a typed connection factory function as an IDbConnectionPool<TConnection>: taking a connection invokes the function and giving it back disposes it.
Methods
- Give(IDbConnection)
Gives a connection back to the pool.
- Take()
Provides a connection of type
TConnectionthat is ready to be handed to a command.
See Also
AsPool<TConnection>(IDbConnectionFactory<TConnection>)