Soenneker.Zelos.Suite
11.0.780
Prefix Reserved
dotnet add package Soenneker.Zelos.Suite --version 11.0.780
NuGet\Install-Package Soenneker.Zelos.Suite -Version 11.0.780
<PackageReference Include="Soenneker.Zelos.Suite" Version="11.0.780" />
<PackageVersion Include="Soenneker.Zelos.Suite" Version="11.0.780" />
<PackageReference Include="Soenneker.Zelos.Suite" />
paket add Soenneker.Zelos.Suite --version 11.0.780
#r "nuget: Soenneker.Zelos.Suite, 11.0.780"
#:package Soenneker.Zelos.Suite@11.0.780
#addin nuget:?package=Soenneker.Zelos.Suite&version=11.0.780
#tool nuget:?package=Soenneker.Zelos.Suite&version=11.0.780
Soenneker.Zelos.Suite
The file-based JSON document database engine
What is Zelos?
Zelos is a lightweight, embedded data store for .NET applications. It leverages JSON for persistent storage while maintaining an in-memory cache for rapid data access. With asynchronous, thread-safe operations, Zelos minimizes I/O overhead by periodically saving only modified containers.
Key Benefits & Features
- Embedded & Minimalistic: Operates without the overhead of an external database server.
- Responsive Asynchronous I/O: Uses async operations to keep your application fast and non-blocking.
- Robust Concurrency: Employs asynchronous locks and semaphores to manage thread safety.
- Container Organization: Segregate your data logically using named containers.
- Efficient Persistence: Automatically saves only when necessary to reduce disk IO.
- Resource Management: Designed to automatically dispose resources when no longer needed, ensuring clean shutdowns.
- Repository Pattern Integration: Streamlines CRUD operations with a familiar design pattern.
Architecture & Components
ZelosDatabase
- Core engine managing the persistence layer.
- Loads or creates the database file on startup.
- Periodically saves dirty containers.
- Manages container initialization and data consistency.
ZelosContainer & IZelosContainerUtil
ZelosContainer:
- Represents an in-memory container for key/value pairs (stored as JSON).
- Handles adding, updating, and deleting items, marking itself as �dirty� for periodic saves.
IZelosContainerUtil:
- Usage: Retrieves containers by combining the database file path and container name.
- Caching & Creation: Manages container lifecycle, ensuring each container is only loaded once.
ZelosRepository
- Provides a higher-level abstraction using the repository pattern.
- Exposes common CRUD operations for generic document types.
- Uses
IZelosContainerUtilinternally to obtain the right container. - Integrates logging and configuration for detailed diagnostics.
Installation
dotnet add package Soenneker.Zelos.Suite
and then register it:
services.AddZelosSuiteAsSingleton();
Zelos User Management Example
This guide demonstrates how to build a simple user management system using Zelos. The example includes:
- UserDocument: A data model representing a user.
- UsersRepository: Inherits from
ZelosRepository<UserDocument>. - UserManager: Injects the repository to perform CRUD operations.
Step 1: Define the User Document
Create a UserDocument class that represents the user data model. This class should inherit from your base Document class.
using Soenneker.Documents.Document;
public class UserDocument : Document
{
public string Name { get; set; } = string.Empty;
public string Email { get; set; } = string.Empty;
}
Step 2: Create the Users Repository
Create an interface (IUsersRepository) for user-specific operations. Then, implement this interface in a class UsersRepository that inherits from ZelosRepository<UserDocument>. The repository will set the database file path and container name (in this case, "users").
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Logging;
using Soenneker.Zelos.Repository;
using Soenneker.Zelos.Container.Util.Abstract;
public class UsersRepository : IZelosRepository<UserDocument>
{
public UsersRepository(IConfiguration configuration, ILogger<UsersRepository> logger,
IZelosContainerUtil containerUtil) : base(configuration, logger, containerUtil)
{
// Set the database file path and container name
DatabaseFilePath = "data/zelos.db";
ContainerName = "users";
}
}
Step 3: Create the User Manager
Create a UserManager class that injects UsersRepository to perform operations. In this class, add a new user, update it, and then delete it.
using System;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.Extensions.Logging;
public class UserManager
{
private readonly IUsersRepository _usersRepository;
private readonly ILogger<UserManager> _logger;
public UserManager(IUsersRepository usersRepository, ILogger<UserManager> logger)
{
_usersRepository = usersRepository;
_logger = logger;
}
public async Task Execute(CancellationToken cancellationToken = default)
{
// Create a new user document.
var user = new UserDocument
{
Id = Guid.NewGuid().ToString(),
Name = "John Doe",
Email = "john@example.com"
};
_logger.LogInformation("Adding user with Id: {UserId}", user.Id);
await _usersRepository.AddItem(user, cancellationToken);
// Update the user.
user.Email = "john.doe@example.com";
_logger.LogInformation("Updating user with Id: {UserId}", user.Id);
await _usersRepository.UpdateItem(user, cancellationToken);
// Delete the user.
_logger.LogInformation("Deleting user with Id: {UserId}", user.Id);
await _usersRepository.DeleteItem(user.Id, cancellationToken);
}
}
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net11.0 is compatible. |
-
net11.0
- Soenneker.Zelos.Repository (>= 11.0.1222)
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.780 | 64 | 11/11/2026 |
| 11.0.779 | 82 | 11/11/2026 |
| 11.0.778 | 79 | 11/11/2026 |
| 11.0.777 | 73 | 11/11/2026 |
| 11.0.776 | 84 | 11/11/2026 |
| 11.0.775 | 79 | 11/11/2026 |
| 11.0.774 | 82 | 11/11/2026 |
| 11.0.773 | 75 | 11/11/2026 |
| 11.0.772 | 91 | 11/3/2026 |
| 11.0.771 | 86 | 11/3/2026 |
| 11.0.770 | 103 | 10/30/2026 |
| 11.0.769 | 102 | 10/27/2026 |
| 11.0.768 | 104 | 10/27/2026 |
| 11.0.767 | 105 | 10/27/2026 |
| 11.0.766 | 99 | 10/26/2026 |
| 11.0.765 | 98 | 10/26/2026 |
| 11.0.764 | 96 | 10/26/2026 |
| 11.0.763 | 107 | 10/26/2026 |
| 4.0.762 | 97 | 10/25/2026 |
| 4.0.761 | 113 | 10/15/2026 |
Updated Soenneker.Zelos.Repository to 11.0.1222