KamiSama.Repositories.Json
11.0.0.2
dotnet add package KamiSama.Repositories.Json --version 11.0.0.2
NuGet\Install-Package KamiSama.Repositories.Json -Version 11.0.0.2
<PackageReference Include="KamiSama.Repositories.Json" Version="11.0.0.2" />
<PackageVersion Include="KamiSama.Repositories.Json" Version="11.0.0.2" />
<PackageReference Include="KamiSama.Repositories.Json" />
paket add KamiSama.Repositories.Json --version 11.0.0.2
#r "nuget: KamiSama.Repositories.Json, 11.0.0.2"
#:package KamiSama.Repositories.Json@11.0.0.2
#addin nuget:?package=KamiSama.Repositories.Json&version=11.0.0.2
#tool nuget:?package=KamiSama.Repositories.Json&version=11.0.0.2
KamiSama.Repositories.Json
Version: 10.0.0
Description
Lazy-loading JSON file repository with synchronous and asynchronous query and mutation APIs. It caches entities in memory and rewrites an existing JSON array file after each mutation, with important failure, atomicity, and concurrency limitations.
How to use
dotnet add package KamiSama.Repositories.Json --version 10.0.0
Point JsonRepository<TEntity> at an existing file containing a JSON array, subscribe to failure events, and prefer asynchronous reads:
using KamiSama.Repositories.Json;
using var repository = new JsonRepository<User>("data/users.json", UserIdComparer.Instance);
repository.LoadFailed += (_, error) => logger.LogError(error, "Could not load users");
repository.SaveFailed += (_, error) => logger.LogError(error, "Could not save users");
User? user = await repository.FindAsync(x => x.Id == userId, cancellationToken);
The repository loads lazily and cannot initialize a missing or invalid file. Mutations rewrite the complete JSON array non-atomically; Update only rewrites objects already changed in memory. Save failures are suppressed after raising SaveFailed, do not roll back the cache, and can leave partial file content. Locking is per instance, queries are live, and separate instances or processes can overwrite each other. Duplicate behavior follows the configured HashSet<TEntity> comparer.
Namespaces
- KamiSama.Repositories.Json (1 types)
Types
- KamiSama.Repositories.Json.JsonRepository<TEntity> - Lazily reads an existing JSON array into a
HashSet<TEntity>and rewrites the complete file after mutations. Writes are non-atomic, update only persists prior in-memory changes, failures are event-reported and suppressed, and locking does not coordinate live queries or other instances.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net11.0 is compatible. |
-
net11.0
- KamiSama.Extensions.Json (>= 11.0.0.2)
- KamiSama.Repositories.Core (>= 11.0.0.2)
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 |
|---|---|---|
| 11.0.0.2 | 78 | 11/23/2026 |
| 11.0.0.1 | 86 | 11/21/2026 |
| 10.0.14 | 95 | 11/8/2026 |
| 10.0.13.1 | 114 | 10/22/2026 |
| 10.0.13 | 107 | 10/22/2026 |
| 10.0.11.9 | 157 | 8/24/2026 |
| 10.0.11.8 | 131 | 8/22/2026 |
| 10.0.11.7 | 136 | 8/21/2026 |
| 10.0.11.6 | 136 | 8/19/2026 |
| 10.0.11.5 | 135 | 8/18/2026 |
| 10.0.11.4 | 133 | 8/18/2026 |
| 10.0.11.3 | 131 | 8/18/2026 |
| 10.0.11.2 | 145 | 8/18/2026 |
| 10.0.11.1 | 144 | 8/15/2026 |
| 10.0.11 | 137 | 8/11/2026 |
| 10.0.10.2 | 156 | 8/4/2026 |
| 10.0.10.1 | 151 | 7/31/2026 |
| 10.0.10 | 146 | 7/30/2026 |
| 10.0.9 | 154 | 6/20/2026 |
| 10.0.7 | 150 | 5/1/2026 |