Skip to content

Repository files navigation

Nj.EntityFrameworkCore.LibSql

Community EF Core 10 provider for libSQL, backed by in-repo Nj.LibSql.Data (architecture).

Status: 10.0.0-preview.2 (prerelease on NuGet.org). APIs may change. Do not use in production until a stable 10.0.x release. See releasing.

dotnet add package Nj.EntityFrameworkCore.LibSql --prerelease

Package identity

Item Value
NuGet package Nj.EntityFrameworkCore.LibSql (also Nj.LibSql.Data, Nj.LibSql.Bindings)
Namespace / assembly Nj.EntityFrameworkCore.LibSql
Version 10.0.0-preview.2
License MIT
EF Core 10.0.10
ADO.NET Nj.LibSql.Data + Nj.LibSql.Bindings (versions)

Public API follows Microsoft’s Sqlite naming pattern (UseLibSql, AddEntityFrameworkLibSql, …). Connection modes are selected only via the connection string (or an existing LibSqlConnection) — no mode-specific Use* helpers. Reference: connection-strings.md, connection-modes.md.

Preview modes

Mode Preview Notes
Local libSQL file Yes File create/delete like EF SQLite
Remote self-hosted sqld / Turso Yes Database must already exist; Turso via HTTPS/libsql:// (Cloud rejects WebSocket)
Embedded replica Yes (vs sqld) Database.Sync / LibSqlConnection.Sync; Turso Cloud Sync hangs — C-019

Quick start — local

dotnet run --project samples/LocalSample

Or in code:

optionsBuilder.UseLibSql("Data Source=/tmp/app.db");

Quick start — remote (sqld or Turso)

./eng/start-sqld.sh && ./eng/wait-for-sqld.sh   # self-hosted
dotnet run --project samples/RemoteSample
# or: LIBSQL_SAMPLE_CONNECTION='Data Source=libsql://…;Auth Token=…' dotnet run --project samples/RemoteSample
optionsBuilder.UseLibSql("Data Source=http://127.0.0.1:8080");
// Turso: Data Source=libsql://<db>-<org>.turso.io;Auth Token=<token>

Quick start — embedded replica

Requires a reachable primary (self-hosted sqld recommended; Turso Sync is C-019):

./eng/start-sqld.sh && ./eng/wait-for-sqld.sh
dotnet run --project samples/EmbeddedReplicaSample
optionsBuilder.UseLibSql(
    "Data Source=/tmp/replica.db;Sync URL=http://127.0.0.1:8080;Read Your Writes=False");
// then: await context.Database.SyncAsync();

DI, pooling, existing connection

dotnet run --project samples/DiPoolingSample

Covers AddDbContextPool, AddDbContextFactory, and UseLibSql(LibSqlConnection).

Migrations / design-time

See samples/MigrationsSample (dotnet-ef 10.0.10, IDesignTimeDbContextFactory, migrate + scaffold). Overview: docs/migrations.md.

Contributor build (no private secrets)

dotnet restore Nj.EntityFrameworkCore.LibSql.slnx
dotnet build Nj.EntityFrameworkCore.LibSql.slnx -c Release
dotnet test test/Nj.EntityFrameworkCore.LibSql.UnitTests -c Release
dotnet run --project samples/LocalSample
./eng/start-sqld.sh && ./eng/wait-for-sqld.sh
dotnet run --project samples/RemoteSample

Full guide: CONTRIBUTING.md.

Documentation

Repository

License

MIT — see LICENSE. Imported EF Core SQLite provider source retains Microsoft’s MIT copyright headers; community modifications are attributed in NOTICE.

About

EF Core 10 provider for libSQL

Resources

Code of conduct

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages