Moongate.Persistence
0.4.0
Prefix Reserved
See the version list below for details.
dotnet add package Moongate.Persistence --version 0.4.0
NuGet\Install-Package Moongate.Persistence -Version 0.4.0
<PackageReference Include="Moongate.Persistence" Version="0.4.0" />
<PackageVersion Include="Moongate.Persistence" Version="0.4.0" />
<PackageReference Include="Moongate.Persistence" />
paket add Moongate.Persistence --version 0.4.0
#r "nuget: Moongate.Persistence, 0.4.0"
#:package Moongate.Persistence@0.4.0
#addin nuget:?package=Moongate.Persistence&version=0.4.0
#tool nuget:?package=Moongate.Persistence&version=0.4.0

Moongate.Persistence
Binary snapshot and journal persistence for serial-identified entities, powered by MemoryPack.
Installation
Requires .NET 10 and a writable storage directory. Use the Moongate version available in your configured NuGet feed. Reference MemoryPack directly in applications that define serializable entities so their source-generator requirement is explicit.
dotnet add package Moongate.Persistence
dotnet add package MemoryPack --version 1.21.4
Features
- Typed
DataAccess<T>collections for entities implementingIMoongateEntity. - Explicit upsert and delete operations recorded in a binary journal.
- Snapshots, journal recovery, checkpoints, and backups.
- Queries using ZLinq and
SaveAllAsyncsupport, including opt-in live entity sources.
Example
Define the entity in Player.cs. Keep MemoryPack field order stable when evolving stored data.
using MemoryPack;
using Moongate.Core.Interfaces.Entities;
using Moongate.Core.Primitives;
[MemoryPackable(GenerateType.VersionTolerant)]
public partial class Player : IMoongateEntity
{
[MemoryPackOrder(0)]
public Serial Id { get; set; }
[MemoryPackOrder(1)]
public string Name { get; set; } = string.Empty;
}
Save and reload an entity in Program.cs. This example owns a temporary directory and removes it after both persistence instances are disposed.
using Moongate.Core.Primitives;
using Moongate.Persistence.Services;
var directory = Path.Combine(Path.GetTempPath(), $"moongate-example-{Guid.NewGuid():N}");
try
{
await using (var persistence = new MoongatePersistenceService(directory))
{
var players = persistence.Register<Player>("players");
await persistence.InitializeAsync();
await players.UpsertAsync(new Player { Id = new Serial(1), Name = "Mario" });
}
await using (var persistence = new MoongatePersistenceService(directory))
{
var players = persistence.Register<Player>("players");
await persistence.InitializeAsync();
Console.WriteLine(players.GetById(new Serial(1))?.Name);
}
}
finally
{
if (Directory.Exists(directory))
{
Directory.Delete(directory, recursive: true);
}
}
Dependencies and scope
This package depends on Moongate.Core, MemoryPack, and ZLinq. Entity identifiers use Serial.
Property assignments are not automatically tracked. Persist changes through UpsertAsync or DeleteAsync. Read APIs return detached entities; changing a returned instance does not save it. Register a live entity source when you want SaveAllAsync to capture application-owned entities.
Autosave scheduling belongs to the host application. This package does not provide an automatic schema-migration framework; plan format changes and backups before changing deployed entity models.
License and source
Licensed under AGPL-3.0-or-later. See the source repository and license.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. 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. |
-
net10.0
- MemoryPack (>= 1.21.4)
- Moongate.Core (>= 0.4.0)
- ZLinq (>= 1.5.6)
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 |
|---|---|---|
| 0.21.0 | 94 | 11/3/2026 |
| 0.20.1 | 109 | 10/22/2026 |
| 0.20.0 | 102 | 10/22/2026 |
| 0.19.0 | 104 | 10/16/2026 |
| 0.18.0 | 115 | 10/16/2026 |
| 0.17.0 | 102 | 10/14/2026 |
| 0.16.0 | 107 | 10/9/2026 |
| 0.15.0 | 106 | 10/7/2026 |
| 0.14.0 | 108 | 10/4/2026 |
| 0.13.0 | 112 | 10/3/2026 |
| 0.12.0 | 99 | 10/2/2026 |
| 0.11.0 | 111 | 9/30/2026 |
| 0.10.0 | 113 | 9/30/2026 |
| 0.9.0 | 115 | 9/27/2026 |
| 0.8.0 | 113 | 9/26/2026 |
| 0.7.0 | 97 | 9/24/2026 |
| 0.6.0 | 117 | 9/21/2026 |
| 0.5.0 | 116 | 9/20/2026 |
| 0.4.1 | 114 | 9/20/2026 |
| 0.4.0 | 116 | 9/19/2026 |