Apex.SqlClient
0.1.0-preview.3
This is a prerelease version of Apex.SqlClient.
dotnet add package Apex.SqlClient --version 0.1.0-preview.3
NuGet\Install-Package Apex.SqlClient -Version 0.1.0-preview.3
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Apex.SqlClient" Version="0.1.0-preview.3" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Apex.SqlClient" Version="0.1.0-preview.3" />
<PackageReference Include="Apex.SqlClient" />
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Apex.SqlClient --version 0.1.0-preview.3
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Apex.SqlClient, 0.1.0-preview.3"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Apex.SqlClient@0.1.0-preview.3
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Apex.SqlClient&version=0.1.0-preview.3&prerelease
#tool nuget:?package=Apex.SqlClient&version=0.1.0-preview.3&prerelease
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

Apex SQL client API contract
Ownership and lifetime
ISqlClient,ISqlConnection,ISqlPool,ISqlPreparedStatement,ISqlCursor, andISqlTransactionare async-disposable.- A pooled connection lease must remain alive while its transaction, prepared statement, cursor, or stream is in use. The pool pins the physical connection until lease-derived resources complete.
SqlRowSetand its rows own managed storage and remain valid after the originating connection is released.- Streaming rows are consumed in order. Implementations may reuse internal transport buffers, but a yielded
SqlRowremains a safe managed value.
Concurrency
- Pools are safe for concurrent callers.
- A connection preserves command submission order. The configured driver pipelining limit controls the number of in-flight commands; it does not reorder results.
- PostgreSQL can pipeline ordered requests. Microsoft SQL Server does not implement MARS
or concurrent TDS requests:
Apex.MsSqlClientserializes commands on each physical connection with one command in flight. Use a pool for concurrency. - Transactions, prepared statements, and cursors are bound to their originating connection. Prepared-statement calls may be submitted concurrently and are serialized in submission order; transaction and cursor operations must not be used concurrently unless their API explicitly states otherwise.
Cancellation
- Every one-shot asynchronous operation accepts a final
CancellationToken. - Cancellation before protocol submission prevents the command from being sent.
- Cancellation after PostgreSQL submission sends a PostgreSQL cancellation request and drains the response so the connection can be reused only after returning to idle state.
- Cancellation after Microsoft SQL Server submission sends TDS
ATTENTIONon the same connection. Apex continues reading until the server's attention acknowledgement and finalDONEtoken are drained. Only then can the connection be reused; an invalid or timed-out drain breaks the connection. - Cancellation after MySQL submission issues
KILL QUERYfrom a short-lived authenticated connection by default. If the kill cannot be delivered, the physical command connection is closed and cannot return to a pool. Disabling active cancellation waits for and drains the response before reporting cancellation. - Commit and rollback use cancellation only before submission. Once sent, they complete deterministically to avoid reporting cancellation after a transaction may already have committed.
Query results
QueryAsyncbuffers aSqlRowSet;StreamAsyncis the backpressured alternative.StreamAsyncyields lifetime-safe rows backed by owned pages. A yielded row remains usable after enumeration advances.ExecuteReaderAsyncreturns the lower-allocation borrowedISqlRowReader; its current row is valid only until the nextReadAsyncor disposal.SqlParametersstores orderedSqlValueinstances. Common scalarSqlValueconversions avoid boxing at parameter construction.- PostgreSQL uses
$1placeholders, MySQL uses?, and Microsoft SQL Server uses@P1,@P2, and so on. Microsoft SQL Server parameters are sent withsp_executesql, not interpolated into SQL. - Column lookup is ordinal and case-sensitive.
- Mapping and collection helpers execute user delegates synchronously for each buffered or streamed row.
- MySQL affected rows use matched-row semantics by default.
UseAffectedRowsswitches to changed rows.SqlCommandResultcarries the last insert identifier, status flags, and warning count;MySqlConnection.LastCommandInfoadditionally exposes the server information string.
Errors and diagnostics
- Database errors derive from
SqlClientException; PostgreSQL errors expose SQLSTATE and structured server fields throughPgException, MySQL errors expose the numeric server code and SQLSTATE throughMySqlException, and SQL Server errors expose number, state, class, server, procedure, and line throughMsSqlException. - Activities and metrics never include passwords or parameter values.
- A physical connection is never returned to a pool while PostgreSQL reports an active or failed transaction.
- A physical MySQL connection is never returned while a transaction is active, autocommit is disabled, or cancellation left the session unsynchronized.
- A Microsoft SQL Server physical connection is not returned while a transaction,
response, or
ATTENTIONdrain is active.
Microsoft SQL Server connection contract
Apex.MsSqlClientis a direct TDS implementation and has no runtime Microsoft.Data.SqlClient dependency.MsSqlConnectOptions.Parseaccepts standard key/value strings andsqlserver://URIs. Unknown keys fail rather than being silently ignored.ConnectTimeoutis one deadline for TCP, TLS, PRELOGIN, routing redirects, LOGIN7, and authentication rather than a TCP-only timeout.StringCacheCapacity(default1024) andStringCacheMaximumByteLength(default128) bound the per-connection, two-hit cache used for repeated UTF-16, UTF-8, and code-page strings. Zero disables it, and disposal clears it.- SQL authentication is supported. Integrated/Windows authentication, Entra ID, and access tokens are not.
EncryptionModevalues areDisable,Optional,Require, andStrict.Requireuses TDS 7.x PRELOGIN TLS negotiation.Strictperforms TLS before PRELOGIN as TDS 8.0 and requests thetds/8.0ALPN.- Certificate validation is enabled by default.
TrustServerCertificateis an explicit opt-out intended for controlled test environments;TlsHostName, client certificates, revocation mode, and a validation callback are exposed. - Microsoft SQL Server row readers consume TDS packet payloads incrementally and apply
pull backpressure at each borrowed row.
StreamAsyncemits rows from every result set in order and preserves the matching metadata on each safe row.
| 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. net11.0 is compatible. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net10.0
- System.IO.Hashing (>= 10.0.11)
-
net11.0
- System.IO.Hashing (>= 10.0.11)
NuGet packages (3)
Showing the top 3 NuGet packages that depend on Apex.SqlClient:
| Package | Downloads |
|---|---|
|
Apex.PgClient
High-performance direct PostgreSQL driver for .NET 10 and .NET 11. |
|
|
Apex.MsSqlClient
High-performance direct Microsoft SQL Server driver for .NET 10 and .NET 11. |
|
|
Apex.MySqlClient
High-performance direct MySQL and MariaDB driver for .NET 10 and .NET 11. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 0.1.0-preview.3 | 90 | 8/17/2026 |
| 0.1.0-preview.2 | 91 | 8/16/2026 |
| 0.1.0-preview.1 | 92 | 8/16/2026 |