Ax.Fw.Storage
12.0.2
See the version list below for details.
dotnet add package Ax.Fw.Storage --version 12.0.2
NuGet\Install-Package Ax.Fw.Storage -Version 12.0.2
<PackageReference Include="Ax.Fw.Storage" Version="12.0.2" />
paket add Ax.Fw.Storage --version 12.0.2
#r "nuget: Ax.Fw.Storage, 12.0.2"
// Install Ax.Fw.Storage as a Cake Addin #addin nuget:?package=Ax.Fw.Storage&version=12.0.2 // Install Ax.Fw.Storage as a Cake Tool #tool nuget:?package=Ax.Fw.Storage&version=12.0.2
Ax.Fw.Storage
Simple document database; based on SQLite
Why?
I just wanted to create an instance of class and write to it, read from it, list it's elements 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 compare integer row with unsigned integer variable using that database, meh" and so on. Why not "key-value" storage? I also wanted to filter my objects by last changed datetime. That's it. My database is not 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:
// getting lifetime
var lifetime = new Lifetime();
// getting db filepath
var dbFile = GetDbPath();
try
{
// create database or open existing; you can omit lifetime parameter, but you should call `Dispose` in this case
using var storage = new SqliteDocumentStorage(dbFile, lifetime);
// 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", lifetime.Token);
// retrieve data
var readDoc = await storage.ReadDocumentAsync(_namespace: "default", _key: "test-key", lifetime.Token);
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", lifetime.Token);
var readSimpleDoc = await storage.ReadSimpleDocumentAsync<string>(_entryId: 123, lifetime.Token);
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.ToCached(_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
{
await lifetime.CompleteAsync();
new FileInfo(dbFile).TryDelete();
}
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. 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. |
-
net6.0
- Ax.Fw (>= 12.0.2)
- System.Data.SQLite.Core (>= 1.0.117)
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.4.240 | 121 | 11/2/2024 |
14.4.239 | 140 | 10/18/2024 |
14.4.237 | 87 | 9/19/2024 |
14.4.236 | 140 | 8/11/2024 |
14.3.235 | 106 | 8/10/2024 |
14.3.234 | 66 | 8/5/2024 |
14.3.233 | 71 | 7/29/2024 |
14.3.232 | 88 | 7/23/2024 |
14.3.231 | 86 | 7/22/2024 |
14.3.230 | 101 | 7/17/2024 |
14.3.229 | 75 | 7/17/2024 |
14.3.228 | 86 | 7/11/2024 |
14.3.227 | 90 | 7/10/2024 |
14.3.226 | 116 | 7/3/2024 |
14.3.225 | 111 | 6/14/2024 |
14.3.224 | 80 | 6/7/2024 |
14.3.223 | 100 | 6/6/2024 |
14.3.222 | 108 | 5/17/2024 |
14.3.221 | 132 | 4/12/2024 |
14.2.219 | 102 | 4/11/2024 |
14.2.218 | 99 | 4/10/2024 |
14.2.217 | 193 | 3/29/2024 |
14.2.216 | 114 | 3/27/2024 |
14.2.215 | 110 | 3/22/2024 |
14.1.212 | 116 | 3/11/2024 |
14.1.211 | 102 | 3/11/2024 |
14.1.210 | 106 | 3/6/2024 |
14.1.208 | 112 | 3/6/2024 |
14.1.206 | 118 | 3/2/2024 |
14.1.205 | 119 | 3/1/2024 |
14.0.204 | 120 | 2/19/2024 |
14.0.203 | 105 | 2/16/2024 |
14.0.201 | 114 | 2/15/2024 |
13.0.200 | 128 | 2/10/2024 |
13.0.199 | 108 | 2/10/2024 |
13.0.198 | 105 | 2/10/2024 |
13.0.197 | 286 | 12/10/2023 |
13.0.196 | 122 | 12/10/2023 |
13.0.195 | 121 | 12/9/2023 |
13.0.194 | 104 | 12/6/2023 |
13.0.192 | 119 | 12/5/2023 |
13.0.191 | 146 | 11/26/2023 |
13.0.189 | 128 | 11/24/2023 |
13.0.186 | 124 | 11/23/2023 |
13.0.185 | 128 | 11/22/2023 |
13.0.182 | 126 | 11/18/2023 |
13.0.181 | 148 | 11/14/2023 |
13.0.180 | 138 | 11/12/2023 |
13.0.179 | 119 | 11/10/2023 |
12.1.178 | 148 | 10/25/2023 |
12.1.177 | 140 | 10/24/2023 |
12.1.176 | 138 | 10/21/2023 |
12.1.175 | 140 | 10/21/2023 |
12.1.173 | 133 | 10/16/2023 |
12.1.172 | 153 | 10/15/2023 |
12.1.171 | 136 | 10/15/2023 |
12.1.170 | 127 | 10/15/2023 |
12.1.168 | 153 | 10/15/2023 |
12.1.167 | 113 | 10/14/2023 |
12.1.166 | 172 | 9/7/2023 |
12.1.165 | 196 | 8/28/2023 |
12.1.164 | 221 | 8/15/2023 |
12.1.163 | 188 | 8/14/2023 |
12.1.162 | 163 | 8/14/2023 |
12.1.161 | 204 | 6/20/2023 |
12.1.160 | 203 | 6/10/2023 |
12.1.158 | 168 | 5/31/2023 |
12.1.157 | 166 | 5/22/2023 |
12.1.7 | 162 | 5/21/2023 |
12.1.0 | 160 | 5/19/2023 |
12.0.21 | 169 | 5/18/2023 |
12.0.20 | 149 | 5/18/2023 |
12.0.19 | 170 | 5/10/2023 |
12.0.18 | 152 | 5/4/2023 |
12.0.17 | 177 | 5/3/2023 |
12.0.16 | 195 | 4/30/2023 |
12.0.15 | 185 | 4/30/2023 |
12.0.13 | 191 | 4/27/2023 |
12.0.12 | 199 | 4/27/2023 |
12.0.10 | 261 | 4/15/2023 |
12.0.9 | 246 | 4/6/2023 |
12.0.8 | 248 | 3/27/2023 |
12.0.7 | 240 | 3/27/2023 |
12.0.3 | 237 | 3/22/2023 |
12.0.2 | 238 | 3/22/2023 |
12.0.1 | 271 | 3/1/2023 |
12.0.0 | 303 | 2/11/2023 |
11.1.10 | 287 | 2/11/2023 |
11.1.9 | 289 | 2/10/2023 |
11.1.8 | 288 | 2/6/2023 |
11.1.7 | 288 | 2/5/2023 |
11.1.6 | 300 | 2/4/2023 |
11.1.5 | 295 | 2/4/2023 |
11.1.4 | 333 | 12/30/2022 |
11.1.3 | 368 | 12/26/2022 |
11.1.2 | 313 | 12/26/2022 |
11.1.1 | 327 | 12/25/2022 |
11.0.0 | 320 | 12/24/2022 |
1.0.0 | 348 | 12/24/2022 |