Rula.Persistence 1.0.7

dotnet add package Rula.Persistence --version 1.0.7
                    
NuGet\Install-Package Rula.Persistence -Version 1.0.7
                    
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="Rula.Persistence" Version="1.0.7" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Rula.Persistence" Version="1.0.7" />
                    
Directory.Packages.props
<PackageReference Include="Rula.Persistence" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Rula.Persistence --version 1.0.7
                    
#r "nuget: Rula.Persistence, 1.0.7"
                    
#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.
#:package Rula.Persistence@1.0.7
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Rula.Persistence&version=1.0.7
                    
Install as a Cake Addin
#tool nuget:?package=Rula.Persistence&version=1.0.7
                    
Install as a Cake Tool

Build

Rula.Persistence

Lightweight, extensible and platform-agnostic save system for .NET applications and games.

Rula.Persistence provides the core abstractions and save management pipeline while allowing applications to choose their own storage, serialization and logging implementations.


Features

  • Platform independent
  • Async save/load operations
  • Multiple save slots
  • Strongly typed saveables
  • Save versioning support
  • Save file migrations
  • Pluggable serializers
  • Pluggable storage providers
  • Pluggable logging
  • Testable architecture
  • Unity friendly through separate integration package

Installation

Add a reference to the package:

dotnet add package Rula.Persistence

Quick Start

Create a saveable object

public sealed class PlayerSaveable
    : ISaveable<PlayerData>
{
    private readonly Player _player;

    public PlayerSaveable(
        Player player)
    {
        _player = player;
    }

    public string SaveKey => "player";

    public PlayerData CaptureState()
    {
        return new PlayerData
        {
            Gold = _player.Gold
        };
    }

    public void RestoreState(
        PlayerData state)
    {
        _player.Gold = state.Gold;
    }
}

Create manager

var saveManager = new SaveManager(
    storage,
    serializer);

Register saveables

saveManager.Register(
    new PlayerSaveable(player));

Save

await saveManager.SaveAsync(
    "slot1");

Load

await saveManager.LoadAsync(
    "slot1");

Architecture

The library is built around a few core abstractions:

ISaveable<T>
ISaveStorage
ISaveSerializer
ISaveLogger
IClock

Applications provide implementations for these interfaces.


Custom Storage

Implement:

ISaveStorage

Example use cases:

  • File system
  • Cloud storage
  • Database
  • PlayerPrefs
  • Encrypted storage

Custom Serialization

Implement:

ISaveSerializer

Supported options include:

  • Newtonsoft.Json
  • System.Text.Json
  • Binary serializers
  • Custom formats

Logging

Implement:

ISaveLogger

or use the built-in:

NullSaveLogger

Save Versioning

Each save file contains a version number.

public static class SaveVersion
{
    public const int Current = 1;
}

The version is validated during loading.


Migrations

Older save files can be upgraded automatically.

public sealed class V1ToV2Migration
    : ISaveMigration
{
    public int FromVersion => 1;

    public int ToVersion => 2;

    public SaveFile Migrate(
        SaveFile saveFile)
    {
        saveFile.Version = 2;

        return saveFile;
    }
}

Register migrations:

var registry =
    new MigrationRegistry();

registry.Register(
    new V1ToV2Migration());

Pass registry to SaveManager:

var manager = new SaveManager(
    storage,
    serializer,
    migrationRegistry: registry);

Unity Support

Unity integration is provided through a separate package:

Rula.Persistence.Unity

This package contains Unity-specific implementations while keeping the core library free of engine dependencies.


Roadmap

  • Unity integration package
  • Encryption package
  • System.Text.Json package
  • Auto-save support
  • Save compression

License

MIT

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  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.  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. 
.NET Core netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.1 is compatible. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .NETStandard 2.1

    • 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.

Version Downloads Last Updated
1.0.7 133 6/22/2026