Purview.Containers.MySql
1.0.0-prerelease.5
dotnet add package Purview.Containers.MySql --version 1.0.0-prerelease.5
NuGet\Install-Package Purview.Containers.MySql -Version 1.0.0-prerelease.5
<PackageReference Include="Purview.Containers.MySql" Version="1.0.0-prerelease.5" />
<PackageVersion Include="Purview.Containers.MySql" Version="1.0.0-prerelease.5" />
<PackageReference Include="Purview.Containers.MySql" />
paket add Purview.Containers.MySql --version 1.0.0-prerelease.5
#r "nuget: Purview.Containers.MySql, 1.0.0-prerelease.5"
#:package Purview.Containers.MySql@1.0.0-prerelease.5
#addin nuget:?package=Purview.Containers.MySql&version=1.0.0-prerelease.5&prerelease
#tool nuget:?package=Purview.Containers.MySql&version=1.0.0-prerelease.5&prerelease
Purview.Containers.MySql
Throwaway MySQL databases for .NET integration testing on WSL Containers (WSLC) or Docker.
dotnet add package Purview.Containers.MySql
Backend-neutral: depends on Purview.Containers.Core and needs a backend package (Purview.Containers.Wsl or Purview.Containers.Docker) and brings MySqlConnector for readiness probing and
connection-string generation.
Requirements
- WSL Containers backend: Windows 10/11 with WSL Containers (
wsl --install --no-distribution), and a.NET 10or later project. A platform-neutralnet10.0project binds the portable facade and gets automatic WSLC-or-Docker selection; a Windows target framework (net10.0-windows10.0.19041.0, x64 or arm64) binds the implementation directly. ThePurview.Containers.Wslpackage suppliesbuildTransitivedefaults forWindowsSdkPackageVersion/PlatformTargetand (for a platform-neutral consumer on a Windows build host) the implementation payload, rejecting an unsupported consumer withPCC0001/PCC0002— see the consumer requirements. - Docker backend: any reachable Docker daemon (
docker info), with anet10.0or later project on any platform. No Windows target framework and noPCCguards apply. - Experimental: the API, defaults and packaging can change between prereleases; there is no production support guarantee.
Quick start
using MySqlConnector;
using Purview.Containers.MySql;
await using var mysql = new MySqlBuilder()
.WithDatabase("tests")
.WithUsername("test")
.WithPassword("test")
.Build();
await mysql.StartAsync(); // waits for a real host-side connection
await using var connection = new MySqlConnection(mysql.GetConnectionString());
await connection.OpenAsync();
API
| Member | Purpose |
|---|---|
MySqlBuilder() / MySqlBuilder(string image) |
Default image mysql:8, or a custom image. |
MySqlBuilder.MySqlPort (3306) |
Container port, mapped to a random host port. |
WithDatabase(string) |
Sets MYSQL_DATABASE (default test). |
WithUsername(string) |
Sets MYSQL_USER (default test). |
WithPassword(string) |
Sets MYSQL_PASSWORD (default test); stored as a redacted Secret. |
WithRootPassword(string) |
Sets MYSQL_ROOT_PASSWORD (default test); stored as a redacted Secret. |
MySqlContainer.GetConnectionString() |
MySqlConnectionStringBuilder connection string for the mapped host port. |
Build() rejects an empty database or password with ContainerConfigurationException.
Readiness
The image logs ready for connections while its temporary initialisation server is still running, so a log
match or a bare TCP check would report readiness too early. The default wait strategy therefore opens a real
host-side MySqlConnector connection (every second) and only returns once it succeeds. Supply your own
strategy with WithWaitStrategy(...) if you need different behaviour.
Documentation
- Backends: WSLC or Docker — choosing and configuring the runtime.
- Modules — the module contract and readiness choices.
- Wait Strategies — overriding readiness checks.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- Microsoft.Extensions.Telemetry.Abstractions (>= 10.10.0)
- MySqlConnector (>= 2.6.2)
- Purview.Containers.Core (>= 1.0.0-prerelease.5)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.0.0-prerelease.5 | 37 | 10/2/2026 |
| 1.0.0-prerelease.4 | 33 | 10/2/2026 |
| 1.0.0-prerelease.3 | 37 | 10/2/2026 |
| 1.0.0-prerelease.2 | 33 | 10/1/2026 |