SimpleJsonStorageOrm 1.3.1
dotnet add package SimpleJsonStorageOrm --version 1.3.1
NuGet\Install-Package SimpleJsonStorageOrm -Version 1.3.1
<PackageReference Include="SimpleJsonStorageOrm" Version="1.3.1" />
<PackageVersion Include="SimpleJsonStorageOrm" Version="1.3.1" />
<PackageReference Include="SimpleJsonStorageOrm" />
paket add SimpleJsonStorageOrm --version 1.3.1
#r "nuget: SimpleJsonStorageOrm, 1.3.1"
#:package SimpleJsonStorageOrm@1.3.1
#addin nuget:?package=SimpleJsonStorageOrm&version=1.3.1
#tool nuget:?package=SimpleJsonStorageOrm&version=1.3.1
Simple JSON Storage
Simple JSON-powered storage interface.
Forewords
- This project is not meant for high performance.
(It runs purely on pure JSON so what could you really expect) - Further documentation is properly documented in source code.
- Whilst utilizing ProgramStorage<T>, you might always want to initialize your DB first. You could achieve it through
ProgramStorageSet<T>.Set(obj), whereSet()is an instance method ofProgramStorageSet<>, andobjis an instance ofT
Quick Start
public class Settings
{
public bool IsOn{get;set; }
...
}
var storage = new ProgramStorage<Settings>(identifier: "com.org.app", name: "Settings");
storage.Set(i=>i.IsOn, true);
storage.Get(i=>i.IsOn); // Will be true.
// Seperate example
public class Person
{
public string Name{get;set; }
}
var storage = new ProgramStorageSet<Person>(identifier: "com.org.app", name: "People");
storage.Add(new()
{
Name = "Andrew"
});
storage.Add(new()
{
Name = "Alexander"
});
// Now storage will look something like: [{Name: "Andrew"}, {Name: "Alexander"}].
// Please check Intellisense for more overloads.
Details
ProgramStorages
ProgramStorage<T>
Resembles a single object. Type is controlled by generic T. IO is instantly saved. Configurable through OnConfiguring() delegate.
ProgramStorageSet<T>
Resembles a set of single object, like DbSet<T> in EF Core. Type is controlled by generic T. IO is instantly saved. Configurable through OnConfiguring() delegate.
DelayedProgramStorageSet<T>
Resembles a set of single object with advanced features like SaveChanges() and auto-saving by time period. Configurable through OnConfiguring() delegate.
OnConfiguring()
OnConfiguring([identifier], (ConfigurationBuilder o) => o..., [JSONSerializerOptions]);
Currently o has 2 extension methods for configuring: UseAutoSaveChanges() and UseCheckOnSaveChanges(). CheckOnSaveChanges works on all 3 types of storage but
UseAutoSaveChanges only applies to DelayedProgramStorageSet.
Storage Pool
Storage pool is something resembles DbContext in EF Core by deriving custom "contexts" from class StoragePool.
Any number and combinations of above storage types would work.
public sealed class SampleStoragePool : StoragePool
{
public ProgramStorageSet<string> Strings { get; set; } = null!;
public SampleStoragePool(string identifier, JsonSerializerOptions? options = null)
{
OnConfiguring(identifier, options);
}
}
Where It's Stored
The default is basically the evaluation of
Path.Join(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData),identifier, $"{name}.json")
Windows default: %APPDATA%/[identifier]/[name].json
In storage pools [name] is your property name.
Mac:
/Users/[username]/Library/Application Support/[identifier]/[name].json (I think so)
Don't know about Linux.
| 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 is compatible. 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. 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. net10.0 was computed. 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. |
-
net6.0
- No dependencies.
-
net7.0
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
IDisposable