WebNet.KvStoreLite
1.0.0
dotnet add package WebNet.KvStoreLite --version 1.0.0
NuGet\Install-Package WebNet.KvStoreLite -Version 1.0.0
<PackageReference Include="WebNet.KvStoreLite" Version="1.0.0" />
<PackageVersion Include="WebNet.KvStoreLite" Version="1.0.0" />
<PackageReference Include="WebNet.KvStoreLite" />
paket add WebNet.KvStoreLite --version 1.0.0
#r "nuget: WebNet.KvStoreLite, 1.0.0"
#:package WebNet.KvStoreLite@1.0.0
#addin nuget:?package=WebNet.KvStoreLite&version=1.0.0
#tool nuget:?package=WebNet.KvStoreLite&version=1.0.0
WebNet.KvStoreLite
A small .NET class library that stores string key/value pairs in a SQLite database file.
Requirements
- .NET 10 SDK
Build
From the repository root:
dotnet build .\WebNet.KvStoreLite.slnx -nologo
Run the full test suite with:
dotnet test .\WebNet.KvStoreLite.slnx -nologo
Run a single test with:
dotnet test .\WebNet.KvStoreLite.Tests\WebNet.KvStoreLite.Tests.csproj -nologo --filter "FullyQualifiedName~GetValue_ReturnsValue_ForExistingSampleKey"
Package layout
The solution contains two projects:
WebNet.KvStoreLite- the SQLite-backed key/value store implementationWebNet.KvStoreLite.Tests- xUnit tests covering the current public API behavior with reusable sample data
Core API
KvStoreOptionsconfigures the database file name and base directoryKvStoreprovides collection creation, inserts, reads, and deletes
Each collection is stored as a SQLite table with two text columns:
k- keyv- value
The backing database file is created at:
<BaseDirectory>\<StoreName>.sqlitedb
Usage
using WebNet.KvStoreLite;
KvStoreOptions options = new()
{
StoreName = "app-data",
BaseDirectory = AppContext.BaseDirectory
};
using KvStore store = new(options);
store.CreateCollection("users");
store.Add(
"users",
new("alice", "admin"),
new("bob", "reader"));
string aliceRole = store.GetValue("users", "alice");
int removed = store.Remove("users", "bob");
var snapshot = store.GetCollection("users");
Behavior to know before changing the code
Addcreates the collection automatically if it does not already exist.GetCollection,GetValue, andRemoverely on the internal command object having already been initialized. In practice, callCreateCollectionorAddbefore using those methods on a freshKvStoreinstance.- Missing values return
string.Empty. AddandRemovereturn the number of affected rows, or0when the operation does not run.- Keys and values are stored as strings only.
- Collection names are inserted directly into SQL statements and are therefore expected to come from trusted inputs.
Data model caveats
- Tables do not enforce unique keys.
GetValuereturns the first matching row for a key.GetCollectionmaterializes rows into aReadOnlyDictionary<string, string>, so duplicate keys in a collection can cause dictionary population to fail.
Documentation
- API comments live in
WebNet.KvStoreLite\KvStore.csandWebNet.KvStoreLite\KvStoreOptions.cs - Architecture notes live in
docs\architecture.md
Tests
The test project uses a small shared sample dataset:
- collection:
users - keys:
alice,bob,charlie - values:
admin,reader,editor
Each test creates its own temporary SQLite database directory so runs stay isolated from one another.
| 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.8)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.0.0 | 87 | 6/7/2026 |