Compze.DbPool
0.4.0-alpha
Prefix Reserved
See the version list below for details.
dotnet add package Compze.DbPool --version 0.4.0-alpha
NuGet\Install-Package Compze.DbPool -Version 0.4.0-alpha
<PackageReference Include="Compze.DbPool" Version="0.4.0-alpha" />
<PackageVersion Include="Compze.DbPool" Version="0.4.0-alpha" />
<PackageReference Include="Compze.DbPool" />
paket add Compze.DbPool --version 0.4.0-alpha
#r "nuget: Compze.DbPool, 0.4.0-alpha"
#:package Compze.DbPool@0.4.0-alpha
#addin nuget:?package=Compze.DbPool&version=0.4.0-alpha&prerelease
#tool nuget:?package=Compze.DbPool&version=0.4.0-alpha&prerelease
Compze.DbPool
Empty databases on demand for integration testing etc. Supports SQL Server, MySql, PostgreSQL and SQLite (Disk and memory mode)
What's in this package?
This package provides database lifecycle management for integration tests:
- Database pooling —
DbPoolmanages a pool of test databases, automatically provisioning and cleaning them between tests
Related packages
| Package | Description |
|---|---|
| Compze.Must | Fluent assertions |
| Compze.xUnitMatrix | xUnit utilities |
License
Apache-2.0
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net11.0 is compatible. |
-
net11.0
- Compze.Contracts (>= 0.7.2)
- Compze.DependencyInjection (>= 0.11.0-alpha)
- Compze.Internals.Logging (>= 0.7.0-alpha)
- Compze.Internals.SystemCE (>= 0.14.0-internal)
- Compze.Threading (>= 0.14.1-alpha)
- Compze.Threading.Interprocess (>= 0.11.1-alpha)
- Compze.Underscore (>= 0.6.0-beta)
- MemoryPack (>= 1.21.4)
NuGet packages (10)
Showing the top 5 NuGet packages that depend on Compze.DbPool:
| Package | Downloads |
|---|---|
|
Compze.DbPool.MicrosoftSql
Empty SQL Server databases on demand for integration testing etc. |
|
|
Compze.DbPool.MySql
Empty MySQL databases on demand for integration testing etc. |
|
|
Compze.DbPool.PostgreSql
PostgreSQL database pool support for Compze integration testing. |
|
|
Compze.DbPool.Sqlite
Discontinued: this is its last version. Compze no longer supports SQLite: it runs one writer at a time, so it could never be a fully supported persistence layer. Use Compze.DbPool.MicrosoftSql, Compze.DbPool.PostgreSql or Compze.DbPool.MySql. Empty SQLite databases on demand for integration testing etc. |
|
|
Compze.DbPool.ServiceClient
How the PostgreSQL, MySQL and SQL Server providers of Compze.DbPool reserve their databases from a DbPool service on the network. Not for direct use: it has no public API. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 0.19.0-alpha | 0 | 12/5/2026 |
| 0.18.1-alpha | 0 | 12/5/2026 |
| 0.18.0-alpha | 0 | 12/5/2026 |
| 0.17.1-alpha | 0 | 12/5/2026 |
| 0.17.0-alpha | 0 | 12/5/2026 |
| 0.16.0-alpha | 0 | 12/5/2026 |
| 0.15.1-alpha | 0 | 12/5/2026 |
| 0.15.0-alpha | 0 | 12/5/2026 |
| 0.14.0-alpha | 0 | 12/5/2026 |
| 0.13.0-alpha | 7 | 12/5/2026 |
| 0.12.0-alpha | 124 | 12/5/2026 |
| 0.11.0-alpha | 67 | 12/5/2026 |
| 0.10.0-alpha | 115 | 12/4/2026 |
| 0.9.0-alpha | 108 | 12/4/2026 |
| 0.8.0-alpha | 178 | 12/3/2026 |
| 0.7.0-alpha | 152 | 12/2/2026 |
| 0.6.0-alpha | 113 | 12/2/2026 |
| 0.5.0-alpha | 139 | 11/29/2026 |
| 0.4.0-alpha | 178 | 11/28/2026 |
| 0.3.1-alpha | 117 | 11/26/2026 |
- **A pool's calls for different reservation names no longer wait for each other's reservation and reset:** `DbPool.ConnectionStringFor` held the pool's lock while it reserved a database, which can wait 45 seconds for a free one, and while it reset it, which can take seconds on a busy server or wait for a lock someone holds on the database. The lock gave up after 30 seconds, so a call for another name, such as another endpoint of the same host starting at the same time, threw a lock timeout. Now the lock is held only to record the reservation; calls for the same name wait until its database is ready, and `Dispose` waits for the reservations still in progress. A database whose reset failed is reset again by the next call for its name, instead of being handed out as it was.
- **A pool that held a database past the end of its reservation throws when disposed,** naming each such database and how long it held it. A reservation lasts 65 seconds; once it has ended, another pool may reserve the database and reset it while it is still in use. That failed the database's users in ways that pointed elsewhere, such as an unknown database or a missing table, and only when another pool happened to take it. Now the overrun fails every time, at its source.
- **The reservations of a process that has exited are released at the next reservation, by any pool on the machine:** each reservation records the process it was made in, so a database a killed or crashed process held is free at once, not 65 seconds later.
- **The pool databases are named `Compze_DbPool_v3_0001` and on, and their reservations are kept apart from those of earlier versions:** an earlier version can't read the reservations this one keeps, and would replace them with none. So pools of the two versions, as in two checkouts of different ages on one machine, never share a database.
- **A SQL layer says how many databases the pools on a machine may create with it: `IDbPoolSqlLayer.MaximumNumberOfDatabases`,** 100 unless the layer says otherwise, as every layer allowed before. Each database the pools create stays, for reuse, so on a database server each one takes disk space for good; Compze.DbPool.Sqlite's in-memory layer allows many more.
- **A reservation that gives up waiting for a free database says why:** how many of the databases were reserved, by how many pools in how many processes, and that a pool waiting for a database keeps those it holds. So when pools that each wait for one more hold every database, none is released until their waits time out, however many databases there are: more tests held databases at once than there were databases. It said only "Have you missed disposing a database pool?", which sent the reader looking for a leak.
- **`DbPoolState.TryReserve` is internal:** only the pool reserves its databases.
- **Requires newer minor versions of other Compze packages:** Compze.DependencyInjection 0.11.0-alpha (was 0.10.0-alpha), Compze.Internals.SystemCE 0.14.0-internal (was 0.12.0-internal), Compze.Threading.Interprocess 0.11.1-alpha (was 0.9.0-alpha). Upgrading to this version upgrades each package listed here too, so their changelogs apply to this upgrade as well.