18 Commits

Author SHA1 Message Date
awakecoding
1dbf1623dd bindings/dotnet: pool local databases in Turso.Data.Sqlite
SqliteConnection had no pool: ClearAllPools and ClearPool were empty,
and every Open created, opened and connected a new native database. The
core only shares a Database while one of its connections is alive, and
closing the last connection runs a full checkpoint. With one connection
per operation, every Open re-read the schema and replayed the WAL, and
every Close checkpointed.

Add SqliteConnectionPool, which keeps one opened database per full path
(case-insensitive on Windows). With Pooling=True, the existing builder
default, each Open gets a fresh native connection on the pooled
database, so PRAGMAs, functions, temp state and open transactions never
leak between opens. Each entry also holds one idle anchor connection so
the database's connection count never drops to zero and Close no longer
checkpoints every time.

ClearPool and ClearAllPools now release pool entries. A database that
still has open connections closes when the last one does. Entries are
also released on AppDomain.ProcessExit so the WAL gets its final
checkpoint. :memory: and shared in-memory databases, which are temp
files deleted when their last connection closes, are never pooled.

As with Microsoft.Data.Sqlite, a pooled file stays open after Close,
so on Windows it cannot be deleted or replaced until ClearPool or
ClearAllPools is called. EnsureDeleted already calls ClearAllPools.
Tests that delete database files now call ClearAllPools first, and the
Readme describes the Pooling keyword.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-05 09:48:12 -04:00
awakecoding
89a103913e bindings/dotnet: enable EF Core remote and replica backends
Route EF Core connection, creator, migration, and helper behavior through the merged Turso.Data.Sqlite backend modes so direct remote and embedded-replica connection strings work without changing local semantics.

Reject client-only SQLite helper SQL before direct-remote execution and keep replica deletion limited to local database sidecars.

Tests: net8/net9/net10 solution build; focused EF local/remote/replica tests; full .NET suite; live Cloud direct/replica EF smoke
2026-09-04 09:26:37 -04:00
awakecoding
28c088f76e bindings/dotnet: route sqlite facade through managed backends
Make Turso.Data.Sqlite preserve its local provider path while routing direct remote and embedded-replica connection strings through Turso.Data. Add multi-statement parsing, managed readers, transactions, batches, SQLite-compatible errors and locking, and reject helpers that need a local handle in direct remote mode.

Keep one narrow friend-assembly bridge so replica callbacks can register against the managed connection's local native handle.

Tests: dotnet build bindings/dotnet/Turso.slnx -c Debug --no-restore
Tests: dotnet test bindings/dotnet/src/Turso.Tests/Turso.Tests.csproj -c Debug -f net9.0 --no-build
2026-09-02 15:48:00 -04:00
awakecoding
e83f1dd861 bindings/dotnet: support batches on embedded replicas
Execute replica batch commands in order through the existing local connection and expose their buffered results through DbDataReader. Keep replica batches non-atomic unless callers attach an explicit transaction, and keep active batch readers inside the sync-operation lifetime gate.

Reset expired remote batch sessions without replaying a possibly partially applied batch. Invalidate an expired transaction stream rather than allowing later statements to escape its transaction.

Tests: dotnet build Turso.Data.csproj (net8.0, net9.0, net10.0); dotnet test Turso.Tests.csproj (207 passed, 1 skipped)
2026-08-31 17:07:05 -04:00
awakecoding
749d0c5c12 bindings/dotnet: pool replicas and schedule pulls
Share file-backed replicas only when Pooling=True while keeping non-pooled paths exclusive and :memory: replicas private. Normalize path identity, hash credential fingerprints, single-flight initialization, and release the shared sync database after the last lease.

Run one automatic pull coordinator per replica with bounded transient retries and immutable status notifications. Keep observer callbacks outside lifecycle locks, preserve stopped status across queued events, and surface terminal failures during close.

Tests: dotnet build bindings\\dotnet\\Turso.slnx --no-restore --configuration Debug; dotnet test bindings\\dotnet\\src\\Turso.Tests\\Turso.Tests.csproj --no-restore --no-build (198 passed, 1 skipped; includes live cloud convergence)
2026-08-28 16:14:32 -04:00
awakecoding
45025f82b8 bindings/dotnet: add connection-string replicas
Route remote Data Source connections with Replica Path through the managed sync database using direct per-connection ownership. Map explicit sync options while rejecting deferred pooling, automatic sync, and replica batches.

Keep explicit TursoSyncDatabase connections caller-owned and close active readers before releasing replica resources.

Tests: focused provider build, replica/remote/managed sync tests, and live Cloud pull convergence
2026-08-28 12:46:35 -04:00
awakecoding
e907db302d bindings/dotnet: add advanced sync database options
Expose partial bootstrap, remote encryption, sync thresholds, logical MVCC pull, and experimental feature settings through the explicit TursoSyncDatabase API. Validate incompatible configurations and preserve the Windows partial-sync guard before mapping options to the native sync configuration.

Tests: dotnet test bindings/dotnet/src/Turso.Tests/Turso.Tests.csproj --filter FullyQualifiedName~TursoAdvancedSyncOptionsTests|FullyQualifiedName~TursoManagedSyncTests
2026-08-27 08:05:01 -04:00
awakecoding
70f506d714 bindings/dotnet: expose managed sync controls
Add explicit push, checkpoint, and statistics operations to the managed replica API while reusing the lifecycle and transport machinery introduced for pull replicas. Keep all sync operations serialized through the existing database gate and surface operation-specific failures.

Tests: dotnet test bindings/dotnet/src/Turso.Tests/Turso.Tests.csproj
2026-08-26 20:15:46 -04:00
awakecoding
46f7f55714 bindings/dotnet: add managed pull replica API
Expose the minimum managed embedded-replica lifecycle on top of the native sync ABI: create or open a replica, connect locally, and pull remote changes safely. Drive HTTP and file I/O with cancellation while coordinating local statement, reader, connection, and database lifetimes.

Advanced sync configuration, push, checkpoint, and statistics remain deferred to focused follow-up changes.
2026-08-26 16:34:14 -04:00
Marc-André Moreau
993e8218fb bindings/dotnet: split NuGet runtime packages
Separate the SQLite provider facade from shared managed interop and precompiled native runtime packages. Keep the provider package focused on the SQLite API, move shared NativeAOT and platform integration into neutral runtime packages, and update packaging, samples, documentation, and CI for the new dependency graph.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
2026-08-04 10:14:58 -04:00
Marc-André Moreau
a81d75ff71 dotnet: support NativeAOT static native linking
Package desktop static turso_sdk_kit archives as RID-specific NativeAOT companion packages and wire an opt-in buildTransitive target that lets NativeAOT consumers use DirectPInvoke instead of publishing a dynamic sidecar library.

Add a NativeAOT sample, validate the packed NuGet static-link path across supported desktop runtime identifiers, and keep the main Turso.Data.Sqlite package below nuget.org's package-size limit.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
2026-07-08 11:03:32 -04:00
Marc-André Moreau
fd699f2f14 Add .NET remote transactions and batch support
Layer remote Hrana transaction baton handling, ADO.NET DbBatch support, multi-result remote readers, and sync API stubs on top of basic remote execution.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-06-25 14:56:43 -04:00
Marc-André Moreau
cfcb8b68e7 Add .NET remote Hrana execution
Add remote connection string parsing, single-statement Hrana pipeline execution, remote reader materialization, and focused mocked remote tests for TursoConnection.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-06-25 14:05:01 -04:00
Marc-André Moreau
9aa442c680 Add Turso EF Core SQLite provider
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-06-24 18:11:42 -04:00
Marc-André Moreau
5632f30601 Add mobile NuGet native targets
Add Android native assets for all portable Android RIDs, package iOS as an XCFramework with device and arm64 simulator slices, and wire mobile assets into the .NET transitive build targets.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-06-19 11:19:47 -04:00
Marc-André Moreau
7869be78a6 Add .NET NuGet package publishing workflow
Build and package the .NET bindings as a single Turso.Data.Sqlite NuGet package. The package bundles the Turso.Data.Sqlite facade, the Turso-specific ADO.NET provider assembly, the raw interop assembly, and native SDK-kit runtime assets for Linux, macOS, and Windows on x64 and arm64.

Add a push-triggered dry-run publishing workflow with native build jobs, artifact collection, gated NuGet publishing, and multi-targeted managed assets for net8.0, net9.0, and net10.0.

Centralize .NET package versioning in Directory.Build.props and wire scripts/update-version.py so NuGet versions stay aligned with the existing Turso release process.

Set managed assembly metadata without appending source revisions to ProductVersion, and add Windows VERSIONINFO metadata for turso_sdk_kit.dll.

Update project layout, README, examples, tests, and build scripts to match the single-package model.

Improve provider-replacement compatibility by making SqliteCommand.Prepare() safe for multi-statement batches, materializing declared GUID/UNIQUEIDENTIFIER values as Guid, and accepting common compatibility connection-string keywords.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-06-12 08:09:23 -04:00
Marc-André Moreau
2d82c65b2e Add SQLite-compatible .NET bindings
Introduce phase-1 .NET support for Turso local databases with NuGet-ready managed packages and a SQLite-compatible facade for migration-oriented users.

This adds the ADO.NET provider surface, `Turso.Data.Sqlite` compatibility types, package metadata, tests, and native asset packaging. The raw interop layer now P/Invokes the shared `turso_sdk_kit` C ABI directly instead of maintaining a bespoke Rust cdylib under `bindings/dotnet/rs_src`.

Advanced SQLite APIs for managed scalar functions, aggregates, collations, and extension loading are intentionally exposed but report that Turso core managed extension support is required. The core implementation is split to a separate PR so this branch stays focused on phase-1 .NET bindings.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-05-19 10:39:38 -04:00
Dmitriy
ff75ff766a Add dotnet bindings 2025-12-03 12:23:10 +04:00