Soenneker.Cloudflare.D1
11.0.51
Prefix Reserved
dotnet add package Soenneker.Cloudflare.D1 --version 11.0.51
NuGet\Install-Package Soenneker.Cloudflare.D1 -Version 11.0.51
<PackageReference Include="Soenneker.Cloudflare.D1" Version="11.0.51" />
<PackageVersion Include="Soenneker.Cloudflare.D1" Version="11.0.51" />
<PackageReference Include="Soenneker.Cloudflare.D1" />
paket add Soenneker.Cloudflare.D1 --version 11.0.51
#r "nuget: Soenneker.Cloudflare.D1, 11.0.51"
#:package Soenneker.Cloudflare.D1@11.0.51
#addin nuget:?package=Soenneker.Cloudflare.D1&version=11.0.51
#tool nuget:?package=Soenneker.Cloudflare.D1&version=11.0.51
Soenneker.Cloudflare.D1
A utility library for Cloudflare D1 database operations.
Installation
dotnet add package Soenneker.Cloudflare.D1
Usage
Targets .NET 10. Register the utility and its Cloudflare client dependency:
using Soenneker.Cloudflare.D1.Registrars;
services.AddCloudflareD1UtilAsSingleton();
// AddCloudflareD1UtilAsScoped() is also available.
Inject ICloudflareD1Util from Soenneker.Cloudflare.D1.Abstract. Supply the account
ID and Cloudflare API bearer token for each call. Store the token in your secret
store; do not embed it in source code. Database reads require D1 Read permission;
mutating operations require D1 Write permission.
using Soenneker.Cloudflare.OpenApiClient.Models;
var databases = await d1.ListDatabases(accountId, apiToken,
page: 1, perPage: 20, cancellationToken: cancellationToken);
var result = await d1.Query(accountId, apiToken, databaseId,
new D1BatchQuery
{
D1SingleQuery = new D1SingleQuery
{
Sql = "SELECT * FROM users WHERE name = ?",
Params = ["Alice"]
}
}, cancellationToken);
Use parameters for SQL values. To submit a batch, populate
D1BatchQuery.D1BatchQueryMember1 with a D1BatchQueryMember1 whose Batch contains
D1SingleQuery objects. Exactly one single-query or batch member must be set.
The generated SDK represents query parameters as strings.
Operations
ListDatabases: one page of databases with optional name filtering.CreateDatabase,GetDatabase,UpdateDatabase,UpdateDatabasePartial, andDeleteDatabase.QueryandQueryRaw: parameterized SQL or batches, returning object rows or raw arrays.ExportDatabaseandImportDatabase: typed requests for the API's export/import stages.GetTimeTravelBookmarkandRestoreDatabase: bookmark lookup and database restoration.
Methods return generated Cloudflare response envelopes, including errors, statement results, and pagination metadata. Inspect envelope and per-statement success fields; HTTP/API exceptions and cancellation propagate to the caller. The utility does not automatically paginate, retry mutations, upload import files, poll export/import jobs, or download exports. Delete and restore calls modify the database immediately.
API reference: https://developers.cloudflare.com/api/resources/d1/subresources/database/
Build and test
dotnet build -c Release
dotnet test --project test/Soenneker.Cloudflare.D1.Tests -c Release -- --treenode-filter '/*/*/CloudflareD1UtilTests/*'
dotnet pack src/Soenneker.Cloudflare.D1 -c Release -o artifacts
Tests use an in-memory HTTP handler and do not require Cloudflare credentials or access live databases.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net11.0 is compatible. |
-
net11.0
- Soenneker.Cloudflare.Utils.Client (>= 11.0.1122)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on Soenneker.Cloudflare.D1:
| Package | Downloads |
|---|---|
|
Soenneker.Librarian.D1
Librarian document storage backed by Cloudflare D1 snapshots. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 11.0.51 | 49 | 11/5/2026 |
| 11.0.50 | 70 | 11/4/2026 |
| 11.0.49 | 54 | 11/3/2026 |
| 11.0.48 | 83 | 11/3/2026 |
| 11.0.47 | 56 | 11/3/2026 |
| 11.0.46 | 91 | 11/3/2026 |
| 11.0.45 | 84 | 11/3/2026 |
| 11.0.44 | 127 | 11/2/2026 |
| 11.0.43 | 101 | 11/2/2026 |
| 11.0.42 | 110 | 11/2/2026 |
| 11.0.41 | 94 | 11/2/2026 |
| 11.0.40 | 89 | 11/2/2026 |
| 11.0.39 | 146 | 10/31/2026 |
| 11.0.38 | 128 | 10/31/2026 |
| 11.0.37 | 108 | 10/30/2026 |
| 11.0.35 | 109 | 10/30/2026 |
| 11.0.34 | 201 | 10/27/2026 |
| 11.0.32 | 153 | 10/27/2026 |
| 11.0.31 | 115 | 10/27/2026 |
| 11.0.30 | 145 | 10/26/2026 |
Updated Soenneker.Cloudflare.Utils.Client to 11.0.1122