WebNet.KvStoreLite 1.0.0

dotnet add package WebNet.KvStoreLite --version 1.0.0
                    
NuGet\Install-Package WebNet.KvStoreLite -Version 1.0.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="WebNet.KvStoreLite" Version="1.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="WebNet.KvStoreLite" Version="1.0.0" />
                    
Directory.Packages.props
<PackageReference Include="WebNet.KvStoreLite" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add WebNet.KvStoreLite --version 1.0.0
                    
#r "nuget: WebNet.KvStoreLite, 1.0.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package WebNet.KvStoreLite@1.0.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=WebNet.KvStoreLite&version=1.0.0
                    
Install as a Cake Addin
#tool nuget:?package=WebNet.KvStoreLite&version=1.0.0
                    
Install as a Cake Tool

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 implementation
  • WebNet.KvStoreLite.Tests - xUnit tests covering the current public API behavior with reusable sample data

Core API

  • KvStoreOptions configures the database file name and base directory
  • KvStore provides collection creation, inserts, reads, and deletes

Each collection is stored as a SQLite table with two text columns:

  • k - key
  • v - 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

  • Add creates the collection automatically if it does not already exist.
  • GetCollection, GetValue, and Remove rely on the internal command object having already been initialized. In practice, call CreateCollection or Add before using those methods on a fresh KvStore instance.
  • Missing values return string.Empty.
  • Add and Remove return the number of affected rows, or 0 when 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.
  • GetValue returns the first matching row for a key.
  • GetCollection materializes rows into a ReadOnlyDictionary<string, string>, so duplicate keys in a collection can cause dictionary population to fail.

Documentation

  • API comments live in WebNet.KvStoreLite\KvStore.cs and WebNet.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 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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