Rulealize.Plugin.SqliteStore 1.0.0

dotnet add package Rulealize.Plugin.SqliteStore --version 1.0.0
                    
NuGet\Install-Package Rulealize.Plugin.SqliteStore -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="Rulealize.Plugin.SqliteStore" Version="1.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Rulealize.Plugin.SqliteStore" Version="1.0.0" />
                    
Directory.Packages.props
<PackageReference Include="Rulealize.Plugin.SqliteStore" />
                    
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 Rulealize.Plugin.SqliteStore --version 1.0.0
                    
#r "nuget: Rulealize.Plugin.SqliteStore, 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 Rulealize.Plugin.SqliteStore@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=Rulealize.Plugin.SqliteStore&version=1.0.0
                    
Install as a Cake Addin
#tool nuget:?package=Rulealize.Plugin.SqliteStore&version=1.0.0
                    
Install as a Cake Tool

Rulealize.Plugin.SqliteStore

A store for Rulealize rule sets that keep instances: every state document in a SQLite database.

Plugin id Rulealize.Plugin.SqliteStore
Namespace sqlite
Reserved prefix none
Depends on Rulealize.Abstraction, Microsoft.Data.Sqlite
Specification doc/specification.md

A rule set whose uses declares a many keeps each instance as a document of its own, and names the store that keeps them in requires. This is one such store. It registers no operation and no schema; a rule set names it and the host opens it:

"requires": [
  { "plugin": "Rulealize.Plugin.TypeSchema" },
  { "plugin": "Rulealize.Plugin.SqliteStore" }
]
RuleContext month = new RuleRuntime()
    .LoadPluginsFrom("plugin")
    .AddPlugin(new SqliteStorePlugin())
    .UseStore(SqliteStorePlugin.Id, new SqliteStateStore("Data Source=state.db"))
    .CreateContext(monthDocument, heldDocuments, startDocuments);

CommittedTransition done = await month.ApplyAsync(
    """{ "input": "submit", "at": { "claims": "1" }, "args": { "by": "ann" } }""");

The host references this package and hands the plugin over with AddPlugin, rather than leaving it in the plugin folder, because it names SqliteStateStore to open one, and UseStore takes a store of the type the loaded plugin declared.

A position is where it was when the process starts again. One table, rulealize_state, made the first time a session is opened, a row per document with a version. A session reads in one snapshot, and on commit refuses with StateConflictException a write to a document that moved since it was read, then keeps all of it or none of it.

Keys are those a MemoryStateStore gives: 1, 2, …, one more than the collection holds. A walk over a rule set kept in memory, and a host kept here, write the same commit documents.

One database is one position. It holds one rule set's own document and the instances it keeps; two rule sets that each keep instances are kept in two databases.

Building

dotnet build. Rulealize.Abstraction and Microsoft.Data.Sqlite restore from nuget.org like any other package, so this repository builds on its own.

dotnet test runs the store's own tests, in test/: a month that keeps its claims, and a ledger that keeps a month per key, each kept in a SQLite file of its own through the Rulealize runtime, and sessions opened directly where two have to race. The runtime and the vocabularies come from nuget.org; the plugin under test is this repository's, handed to the runtime as an instance.

License

Apache-2.0.

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 139 10/24/2026