AxTools.Common 1.0.0

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

// Install AxTools.Common as a Cake Tool
#tool nuget:?package=AxTools.Common&version=1.0.0

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
	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
	var cachedStorage = storage.ToCached(_maxValuesCached: 1000, _cacheTtl: TimeSpan.FromSeconds(60));
}
finally
{
	await lifetime.CompleteAsync();
	new FileInfo(dbFile).TryDelete();
}
Product 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. 
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.7.710 72 5/10/2024
14.6.709 94 3/31/2024
14.5.706 99 2/1/2024
14.5.705 97 1/18/2024
14.5.704 101 1/11/2024
14.5.703 171 12/11/2023
14.5.702 114 12/9/2023
14.5.701 90 12/8/2023
14.5.700 128 11/19/2023
14.5.699 100 11/19/2023
14.5.698 104 11/18/2023
14.5.697 101 11/17/2023
14.4.696 131 10/4/2023
14.4.2 112 9/26/2023
14.4.1 139 9/14/2023
14.4.0 127 9/11/2023
14.3.1 165 8/21/2023
14.3.0 139 7/18/2023
14.2.3 124 6/4/2023
14.2.2 132 5/31/2023
14.2.1 145 5/17/2023
14.2.0 118 5/17/2023
14.1.0 163 4/15/2023
14.0.13 221 3/3/2023
14.0.12 233 2/25/2023
14.0.11 245 2/10/2023
1.0.0 286 2/9/2023