Ax.Fw.Storage 14.5.246

There is a newer version of this package available.
See the version list below for details.
dotnet add package Ax.Fw.Storage --version 14.5.246                
NuGet\Install-Package Ax.Fw.Storage -Version 14.5.246                
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="Ax.Fw.Storage" Version="14.5.246" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Ax.Fw.Storage --version 14.5.246                
#r "nuget: Ax.Fw.Storage, 14.5.246"                
#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.
// Install Ax.Fw.Storage as a Cake Addin
#addin nuget:?package=Ax.Fw.Storage&version=14.5.246

// Install Ax.Fw.Storage as a Cake Tool
#tool nuget:?package=Ax.Fw.Storage&version=14.5.246                

Ax.Fw.Storage

Simple document database; based on SQLite

Why?

I just wanted to create an instance of class and be able to write to database, read from database, enumerate elements in database by key without thinking about "this database's BSON don't support ImmutableDictionary, meh", "that database doesn't support numeric keys, meh", "ah, I can't search for values of integer column using unsigned integer variable, meh" and so on. Why not "key-value" storage? I also wanted to filter my objects by last changed time. That's it. This document storage engine is not as fast as more "strongly-typed" databases (I think it's 1.1 - 1.5x slower in some scenarios), but it is reliable as any SQLite database.

Usage example:

// we need CancellationToken
var ct = default(CancellationToken);

// path to database file
var dbFile = "/home/user/data.db"

try
{
    // create database or open existing
    using var storage = new SqliteDocumentStorage(dbFile);

    // create document; pair 'namespace - key' is unique; any json serializable data can be stored
    var doc = await storage.WriteDocumentAsync(_namespace: "default", _key: "test-key", _data: "test-data-0", ct);

    // retrieve data
    var readDoc = await storage.ReadDocumentAsync(_namespace: "default", _key: "test-key", ct);

    Assert.Equal("test-data-0", readDoc?.Data.ToObject<string>());

    // there are also 'simple' documents; 
    // namespace of simple documents is automatically determined by data type or by `SimpleDocumentAttribute`
    var simpleDoc = await storage.WriteSimpleDocumentAsync(_entryId: 123, _data: "test_data", ct);

    var readSimpleDoc = await storage.ReadSimpleDocumentAsync<string>(_entryId: 123, ct);

    Assert.Equal("test_data", readSimpleDoc?.Data);

    // you also can attach in-memory cache to document storage
    // cache makes read operations significantly faster
    using var cachedStorage = storage.WithCache(_maxValuesCached: 1000, _cacheTtl: TimeSpan.FromSeconds(60));

    // you also can attach retention rules to document storage
    // documents older than certain age will be automatically deleted
    using var storageWithRules = storage
      .WithRetentionRules(TimeSpan.FromHours(1), TimeSpan.FromHours(1), TimeSpan.FromMinutes(10));
}
finally
{
    new FileInfo(dbFile).TryDelete();
}
Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.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
14.5.247 126 2 months ago
14.5.246 82 2 months ago
14.5.245 90 2 months ago
14.5.244 83 2 months ago
14.5.242 76 2 months ago
14.5.241 77 2 months ago
14.4.240 172 5 months ago
14.4.239 173 5 months ago
14.4.237 105 6 months ago
14.4.236 155 7 months ago
14.3.235 122 7 months ago
14.3.234 82 8 months ago
14.3.233 88 8 months ago
14.3.232 102 8 months ago
14.3.231 101 8 months ago
14.3.230 118 8 months ago
14.3.229 89 8 months ago
14.3.228 101 8 months ago
14.3.227 105 8 months ago
14.3.226 133 9 months ago
14.3.225 124 9 months ago
14.3.224 95 10 months ago
14.3.223 111 10 months ago
14.3.222 120 5/17/2024
14.3.221 147 4/12/2024
14.2.219 111 4/11/2024
14.2.218 108 4/10/2024
14.2.217 205 3/29/2024
14.2.216 125 3/27/2024
14.2.215 121 3/22/2024
14.1.212 125 3/11/2024
14.1.211 112 3/11/2024
14.1.210 116 3/6/2024
14.1.208 123 3/6/2024
14.1.206 127 3/2/2024
14.1.205 130 3/1/2024
14.0.204 135 2/19/2024
14.0.203 119 2/16/2024
14.0.201 131 2/15/2024
13.0.200 143 2/10/2024
13.0.199 121 2/10/2024
13.0.198 119 2/10/2024
13.0.197 302 12/10/2023
13.0.196 131 12/10/2023
13.0.195 130 12/9/2023
13.0.194 115 12/6/2023
13.0.192 129 12/5/2023
13.0.191 160 11/26/2023
13.0.189 138 11/24/2023
13.0.186 134 11/23/2023
13.0.185 138 11/22/2023
13.0.182 135 11/18/2023
13.0.181 158 11/14/2023
13.0.180 154 11/12/2023
13.0.179 129 11/10/2023
12.1.178 157 10/25/2023
12.1.177 151 10/24/2023
12.1.176 148 10/21/2023
12.1.175 151 10/21/2023
12.1.173 143 10/16/2023
12.1.172 169 10/15/2023
12.1.171 146 10/15/2023
12.1.170 137 10/15/2023
12.1.168 162 10/15/2023
12.1.167 122 10/14/2023
12.1.166 183 9/7/2023
12.1.165 210 8/28/2023
12.1.164 237 8/15/2023
12.1.163 200 8/14/2023
12.1.162 173 8/14/2023
12.1.161 213 6/20/2023
12.1.160 215 6/10/2023
12.1.158 182 5/31/2023
12.1.157 180 5/22/2023
12.1.7 179 5/21/2023
12.1.0 176 5/19/2023
12.0.21 182 5/18/2023
12.0.20 165 5/18/2023
12.0.19 186 5/10/2023
12.0.18 166 5/4/2023
12.0.17 192 5/3/2023
12.0.16 210 4/30/2023
12.0.15 199 4/30/2023
12.0.13 208 4/27/2023
12.0.12 215 4/27/2023
12.0.10 277 4/15/2023
12.0.9 262 4/6/2023
12.0.8 263 3/27/2023
12.0.7 258 3/27/2023
12.0.3 252 3/22/2023
12.0.2 253 3/22/2023
12.0.1 285 3/1/2023
12.0.0 320 2/11/2023
11.1.10 304 2/11/2023
11.1.9 306 2/10/2023
11.1.8 307 2/6/2023
11.1.7 304 2/5/2023
11.1.6 316 2/4/2023
11.1.5 313 2/4/2023
11.1.4 350 12/30/2022
11.1.3 384 12/26/2022
11.1.2 330 12/26/2022
11.1.1 343 12/25/2022
11.0.0 339 12/24/2022
1.0.0 365 12/24/2022