AlirezaMahDev.Extensions.DataManager 0.0.1-alpha7

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

AlirezaMahDev.Extensions.DataManager

Project Description

This project provides a high-performance, file-based data management system for .NET applications. It implements the abstractions defined in AlirezaMahDev.Extensions.DataManager.Abstractions to offer a concrete, efficient data storage solution. The library is designed for scenarios requiring fast, reliable, and concurrent access to structured data with minimal overhead.

Key Features

  • File-based Storage: Efficient storage of structured data in files
  • Concurrent Access: Thread-safe operations for multi-threaded scenarios
  • Memory Management: Smart caching and memory optimization
  • Temporary Data Support: Specialized handling for temporary data
  • Resource Management: Proper disposal of resources with IDisposable
  • Asynchronous Operations: Full async support for all I/O operations

Core Components

IDataManager

The main interface for managing data access:

  • Open: Opens or creates a data store with the specified key
  • Close: Closes and cleans up resources for a specific data store
  • OpenTemp: Creates a temporary data store for short-lived data

DataAccess

Implements IDataAccess to provide:

  • Memory-mapped file operations
  • Thread-safe concurrent access
  • Efficient data caching
  • Resource management

DataManager

The main implementation of IDataManager that:

  • Manages multiple data stores
  • Handles resource cleanup
  • Implements the builder pattern for configuration

Usage Example

// Configure services
services.AddDataManager(options =>
{
    options.DirectoryPath = "Data";
    options.FileFormat = "{0}.data";
});

// Resolve and use
using var scope = serviceProvider.CreateScope();
var dataManager = scope.ServiceProvider.GetRequiredService<IDataManager>();

// Open a data store
using var dataAccess = dataManager.Open("mydata");

// Get or create root location
var root = dataAccess.GetRoot();

// Work with data...

Configuration

The DataManager can be configured using DataManagerOptions:

services.AddDataManager(options =>
{
    options.DirectoryPath = "App_Data";  // Base directory for data files
    options.FileFormat = "{0}.dat";      // File naming pattern
});

Dependencies

Project Dependencies

  • AlirezaMahDev.Extensions.DataManager.Abstractions: Core interfaces
  • AlirezaMahDev.Extensions: Extension infrastructure

NuGet Dependencies

  • System.IO.Hashing: For checksum and hash operations

Performance Considerations

  • Caching: Implements in-memory caching of frequently accessed data
  • Lazy Loading: Resources are loaded on demand
  • Concurrent Access: Uses thread-safe collections for concurrent operations
  • Efficient I/O: Utilizes RandomAccess for high-performance file operations

Error Handling

The library throws appropriate exceptions for error conditions:

  • ArgumentNullException for null arguments
  • ObjectDisposedException for operations on disposed objects
  • IOException for I/O related errors

Thread Safety

All public members of DataManager and DataAccess are thread-safe and may be used concurrently from multiple threads.

Resource Management

All types that implement IDisposable should be properly disposed to release system resources. The recommended pattern is to use the using statement:

using var dataAccess = dataManager.Open("mydata");
// Use dataAccess here

Implementation Notes

  • Uses memory-mapped files for efficient data access
  • Implements a simple but effective caching mechanism
  • Designed for both small and large data sets
  • Supports both synchronous and asynchronous operations
Product 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on AlirezaMahDev.Extensions.DataManager:

Package Downloads
AlirezaMahDev.Extensions.Brain

Package Description

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.0.1-alpha7 411 12/8/2025
0.0.1-alpha 269 12/7/2025