StringThing.Sqlite
0.1.0
See the version list below for details.
dotnet add package StringThing.Sqlite --version 0.1.0
NuGet\Install-Package StringThing.Sqlite -Version 0.1.0
<PackageReference Include="StringThing.Sqlite" Version="0.1.0" />
<PackageVersion Include="StringThing.Sqlite" Version="0.1.0" />
<PackageReference Include="StringThing.Sqlite" />
paket add StringThing.Sqlite --version 0.1.0
#r "nuget: StringThing.Sqlite, 0.1.0"
#:package StringThing.Sqlite@0.1.0
#addin nuget:?package=StringThing.Sqlite&version=0.1.0
#tool nuget:?package=StringThing.Sqlite&version=0.1.0
StringThing.Sqlite
Injection-safe interpolated SQL for SQLite, built on Microsoft.Data.Sqlite. Part of StringThing.
SQLite is dynamically typed — the compile-time type contract here is light. The value is injection safety by construction, parameter deduplication, and composable fragments.
Install
dotnet add package StringThing.Sqlite
Quick start
var userId = 42;
SqliteSql stmt = $"SELECT name FROM users WHERE id = {userId}";
using var command = stmt.ToCommand(connection);
Parameters are named automatically using the variable name: @userId, not @p0.
No container or server needed — SQLite is embedded.
Supported types
bool, byte, short, int, long, float, double, decimal, string, char, Guid, DateTime, DateTimeOffset, DateOnly, TimeOnly, TimeSpan, byte[].
SQLite is dynamically typed — values are stored as TEXT, INTEGER, REAL, BLOB, or NULL regardless of the declared column type. StringThing ensures the .NET value reaches SQLite correctly.
Nullable reference types (string?, byte[]?) map to NULL.
Fragments
var minAge = 18;
var status = "active";
SqliteFragment filter = $"age >= {minAge} AND status = {status}";
SqliteSql stmt = $"SELECT * FROM users WHERE {filter}";
Multi-row insert
record InsertUser(int Id, string Name, string? Email) : ISqliteRow
{
public SqliteFragment RowValues => $"({Id}, {Name}, {Email})";
}
var users = new InsertUser[] { new(1, "alice", "alice@example.com"), new(2, "bob", null) };
SqliteSql stmt = $"INSERT INTO users (id, name, email) VALUES {SqliteSql.InsertRows(users)}";
IN list
var ids = new List<int> { 1, 2, 3 };
SqliteSql stmt = $"SELECT * FROM users WHERE id IN {SqliteSql.InList([.. ids])}";
Unsafe escape hatch
using StringThing.UnsafeSql;
var tableName = Sql.Unsafe("users");
SqliteSql stmt = $"SELECT * FROM {tableName} WHERE id = {userId}";
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. 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. |
-
net10.0
- Microsoft.Data.Sqlite (>= 10.0.5)
- StringThing.Core (>= 0.1.0)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on StringThing.Sqlite:
| Package | Downloads |
|---|---|
|
StringThing.Sqlite.Dapper
Dapper result mapping for StringThing.Sqlite. Injection-safe interpolated SQL on input, Dapper mapping on output. Dapper is bundled internally. |
GitHub repositories
This package is not used by any popular GitHub repositories.