CloudflareD1.NET
1.12.0
dotnet add package CloudflareD1.NET --version 1.12.0
NuGet\Install-Package CloudflareD1.NET -Version 1.12.0
<PackageReference Include="CloudflareD1.NET" Version="1.12.0" />
<PackageVersion Include="CloudflareD1.NET" Version="1.12.0" />
<PackageReference Include="CloudflareD1.NET" />
paket add CloudflareD1.NET --version 1.12.0
#r "nuget: CloudflareD1.NET, 1.12.0"
#:package CloudflareD1.NET@1.12.0
#addin nuget:?package=CloudflareD1.NET&version=1.12.0
#tool nuget:?package=CloudflareD1.NET&version=1.12.0
CloudflareD1.NET
A complete .NET adapter for Cloudflare D1 - the serverless SQL database running on Cloudflare's edge network. This library provides seamless integration with Cloudflare's D1 database, supporting both local SQLite development and remote D1 production deployments.
Features
- ✅ Dual Mode Support: Seamlessly switch between local SQLite (development) and remote D1 (production)
- ✅ Full CRUD Operations: Execute queries, inserts, updates, deletes, and batch operations
- ✅ Parameterized Queries: Prevent SQL injection with built-in parameter binding
- ✅ Time Travel Queries: Query historical data with D1's time travel capabilities
- ✅ Database Management: Create, list, and query database metadata
- ✅ Type-Safe: Strongly typed models and response objects
- ✅ Async/Await: Full async support throughout the library
- ✅ Comprehensive Error Handling: Detailed exception types for different error scenarios
- ✅ Well Tested: 183 unit tests ensuring reliability
Installation
dotnet add package CloudflareD1.NET
Quick Start
using CloudflareD1.NET;
// Configure for remote D1 (production)
var config = new D1Configuration
{
AccountId = "your-account-id",
DatabaseId = "your-database-id",
ApiToken = "your-api-token"
};
var client = new D1Client(config);
// Execute a query
var result = await client.QueryAsync<User>("SELECT * FROM users WHERE id = ?", 1);
// Insert data
await client.ExecuteAsync(
"INSERT INTO users (name, email) VALUES (?, ?)",
"John Doe",
"john@example.com"
);
Related Packages
- CloudflareD1.NET.Linq - LINQ query builder with IQueryable support, compiled queries, async streaming
- CloudflareD1.NET.CodeFirst - Code-First ORM with DbContext pattern and entity relationships
- CloudflareD1.NET.Migrations - Database migration system with version tracking
- dotnet-d1 - CLI tool for managing migrations
Documentation
Full documentation is available at https://jdtoon.github.io/CloudflareD1.NET
License
MIT License - see LICENSE for details
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. 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. |
| .NET Core | netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.1 is compatible. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen60 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.1
- Microsoft.Data.Sqlite (>= 9.0.10)
- Microsoft.Extensions.Configuration.Abstractions (>= 9.0.10)
- Microsoft.Extensions.Configuration.Binder (>= 9.0.10)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 9.0.10)
- Microsoft.Extensions.Http (>= 9.0.10)
- Microsoft.Extensions.Logging.Abstractions (>= 9.0.10)
- Microsoft.Extensions.Options (>= 9.0.10)
- Microsoft.Extensions.Options.ConfigurationExtensions (>= 9.0.10)
- System.Text.Json (>= 9.0.10)
NuGet packages (3)
Showing the top 3 NuGet packages that depend on CloudflareD1.NET:
| Package | Downloads |
|---|---|
|
CloudflareD1.NET.Linq
LINQ query builder and object mapping extensions for CloudflareD1.NET. Provides CompiledQuery for 95% faster repeated query execution with automatic expression tree caching, IQueryable<T> with deferred execution, async streaming with IAsyncEnumerable<T> for memory-efficient result processing, Set Operations (Union, UnionAll, Intersect, Except), Distinct() for removing duplicates, Contains()/IN clause for collection filtering, Join operations (INNER JOIN, LEFT JOIN), Having clause for filtered aggregations, GroupBy with aggregations (Count, Sum, Average, Min, Max), type-safe query construction with expression trees, Select() projection with computed properties, entity mapping, and fluent API for building SQL queries using lambda expressions. All query methods support CancellationToken. |
|
|
CloudflareD1.NET.CodeFirst
Code-First ORM for CloudflareD1.NET. Define your database schema using C# classes and attributes, with automatic migration generation. Includes DbContext pattern, entity relationships, and model-driven development similar to Entity Framework Core but optimized for Cloudflare D1 and SQLite. |
|
|
CloudflareD1.NET.Migrations
Database migration support for CloudflareD1.NET. Provides schema versioning, migration tracking, and fluent API for defining database changes. Works with both local SQLite and remote Cloudflare D1 databases. |
GitHub repositories
This package is not used by any popular GitHub repositories.
v1.12.0: Minor release updating documentation (Docs v2.0), stability improvements, and housekeeping. v1.11.3: Production-ready features - Health check API (CheckHealthAsync), automatic retry with exponential backoff for transient failures (429, 503), enhanced structured logging with query duration and metadata. v1.11.2: Documentation improvements. v1.11.1: Removed transaction features requiring Workers-only API support. 296 tests passing.