An alternative libSQL .NET client, supporting HTTP protocol, fully trimmable and AOT compatible.
Warning
This is not an official libSQL client
This client is a .NET implementation of HRANA protocol, intented to communicate with libSQL server.
This lib is inspired by libsql-stateless-easy.
- .NET 8 (6 and 7 are supported as well)
Install Nuget package:
dotnet add package LibSql.Http.Client
The instance of the client expect an instance of HttpClient.
The most performant way is use a singleton instance of HttpClient.
Check the offical .NET HTTP client guidelines for more information.
var handler = new SocketsHttpHandler
{
PooledConnectionLifetime = TimeSpan.FromMinutes(15) // Recreate every 15 minutes
};
var sharedClient = new HttpClient(handler);
var libSqlClient = new LibSqlHttpClient(sharedClient, new Uri("http://localhost:8080"));
- ✅ Single and batch commands
- ✅ Transactions (*)
- ✅ Positional args
- ✅ Named args via Dictionary
- ✅ Micro ORM like queries and results with minimum overhead
- ❌ Interactive transactions not supported (transactions are done in a single request)
* Transactions are possible per statement(s) only. So distributed transaction is not possible (yet)!
dotnet run --project src/LibSql.Http.Client.DemoConsoleApp/LibSql.Http.Client.DemoConsoleApp.csproj
Check the code.