PersistX 1.0.0

dotnet add package PersistX --version 1.0.0
                    
NuGet\Install-Package PersistX -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="PersistX" Version="1.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="PersistX" Version="1.0.0" />
                    
Directory.Packages.props
<PackageReference Include="PersistX" />
                    
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 PersistX --version 1.0.0
                    
#r "nuget: PersistX, 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.
#:package PersistX@1.0.0
                    
#: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=PersistX&version=1.0.0
                    
Install as a Cake Addin
#tool nuget:?package=PersistX&version=1.0.0
                    
Install as a Cake Tool

<div align="center"> <img src="assets/PersistX.png" alt="PersistX Logo" width="200"/>

PersistX

A high-performance persistent collection library for .NET with ACID transactions, indexing, and advanced data structures.

NuGet NuGet Downloads License: MIT </div>

๐ŸŽฏ Overview

PersistX is a next-generation replacement for simple file-based persistent collections. Unlike existing libraries, PersistX supports scalability, performance, transactions, indexing, async APIs, and advanced collection types, making it feel like a mini embedded database engine but with collection-first abstractions.

โœจ Features

โœ… Implemented (v1.0.0)

  • File-Based Collections: Easy-to-use persistent collections (List, Dictionary, Set)
  • Database Collections: Enterprise-grade collections with advanced features
  • Storage Backends: File, In-Memory, and SQLite storage
  • Transaction Support: ACID transactions with savepoints
  • Indexing: Hash-based indexes for fast lookups
  • Serialization: JSON serialization support
  • Async APIs: Full async/await support throughout
  • Batch Operations: High-performance bulk operations
  • Performance Optimized: Optimized for large datasets

๐Ÿ—๏ธ Project Structure

PersistX/
โ”œโ”€โ”€ FileBased/        # File-based, standalone collections
โ”‚   โ”œโ”€โ”€ PersistentList.cs
โ”‚   โ”œโ”€โ”€ PersistentDictionary.cs
โ”‚   โ””โ”€โ”€ PersistentSet.cs
โ”œโ”€โ”€ Database/         # Database operations and management
โ”‚   โ”œโ”€โ”€ Database.cs
โ”‚   โ”œโ”€โ”€ DatabaseFactory.cs
โ”‚   โ””โ”€โ”€ TransactionManager.cs
โ”œโ”€โ”€ Collections/      # Database-integrated collections
โ”‚   โ””โ”€โ”€ PersistentCollection.cs
โ”œโ”€โ”€ Indexes/          # Indexing system
โ”‚   โ””โ”€โ”€ HashIndex.cs
โ”œโ”€โ”€ Storage/          # Storage backends
โ”‚   โ”œโ”€โ”€ FileStorage.cs
โ”‚   โ”œโ”€โ”€ MemoryStorage.cs
โ”‚   โ””โ”€โ”€ SQLiteStorage.cs
โ”œโ”€โ”€ Serialization/    # Serialization
โ”‚   โ””โ”€โ”€ JsonSerializer.cs
โ””โ”€โ”€ Interfaces/       # Core interfaces
    โ”œโ”€โ”€ IPersistentCollection.cs
    โ”œโ”€โ”€ IDatabase.cs
    โ”œโ”€โ”€ IBackend.cs
    โ”œโ”€โ”€ IIndex.cs
    โ””โ”€โ”€ ISerializer.cs

๐Ÿš€ Quick Start

๐Ÿ“ฆ Installation

Package Manager Console
Install-Package PersistX
.NET CLI
dotnet add package PersistX
PackageReference (csproj)
<PackageReference Include="PersistX" Version="1.0.0" />
Direct Download

Download from NuGet Download from NuGet.org

File-Based Collections (Quick & Easy)

using PersistX.FileBased;

// Create a persistent list
var tasks = new PersistentList<string>("tasks.json");
await tasks.AddAsync("Complete project");
await tasks.AddAsync("Review code");

// Create a persistent dictionary
var settings = new PersistentDictionary<string, object>("settings.json");
await settings.SetAsync("theme", "dark");
await settings.SetAsync("notifications", true);

// Create a persistent set
var tags = new PersistentSet<string>("tags.json");
await tags.AddAsync("work");
await tags.AddAsync("urgent");

Database Collections (Enterprise Features)

using PersistX.Database;
using PersistX.Collections;

// Create a database
var database = await DatabaseFactory.CreateFileDatabaseAsync("MyApp", "app.db");

// Create a collection with indexes
var users = await database.CreateCollectionAsync<User>("users");
await users.CreateIndexAsync("email_index", u => u.Email);
await users.CreateIndexAsync("name_index", u => u.Name);

// Add users with transactions
await database.ExecuteInTransactionAsync(async transaction =>
{
    await users.AddAsync(new User { Name = "John", Email = "john@example.com" });
    await users.AddAsync(new User { Name = "Jane", Email = "jane@example.com" });
});

// Search using indexes
var emailIndex = await users.GetIndexAsync<string>("email_index");
await foreach (var user in emailIndex.FindAsync("john@example.com"))
{
    Console.WriteLine($"Found: {user.Name}");
}

๐Ÿ“ File Storage

File-Based Collections

  • Default Path: ./persistx_data/ (relative to application)
  • Custom Path: Specify full path in constructor
  • File Format: JSON files (.json)

Database Collections

  • Default Path: ./persistx_data/ (relative to application)
  • Custom Path: Specify full path in DatabaseFactory.CreateFileDatabaseAsync()
  • File Format: Database files (.db) with metadata

Example Paths

// File-based collections
var list = new PersistentList<string>("C:/MyApp/data/tasks.json");

// Database collections
var db = await DatabaseFactory.CreateFileDatabaseAsync("MyApp", "C:/MyApp/data/app.db");

๐Ÿงช Testing & Examples

Run the test console application to see all features in action:

cd src/PersistX.Test
dotnet run

The test application includes:

  • File-Based Collections Demo: Basic operations and file management
  • Database Collections Demo: Advanced features, transactions, and indexing
  • Performance Tests: Bulk operations and performance benchmarks
  • Real-World Examples: Shopping cart, blog system, inventory management

๐Ÿ“š Documentation

๐Ÿ“ฆ NuGet Package

<PackageReference Include="PersistX" Version="1.0.0" />

Package Structure

  • PersistX: Core library with all features
  • PersistX.FileBased: File-based collections only (lightweight)
  • PersistX.Database: Database collections only (enterprise)

๐Ÿค Contributing

We welcome contributions! Please see our Contributing Guidelines for details.

๐Ÿ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

๐Ÿ™ Acknowledgments

  • Built with .NET 9.0
  • Inspired by modern database design principles
  • Community feedback and contributions
Product Compatible and additional computed target framework versions.
.NET net9.0 is compatible.  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. 
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
1.0.0 155 9/7/2025