AlirezaMahDev.Extensions.File.Data.Collection.Abstractions 0.0.1-alpha7

This is a prerelease version of AlirezaMahDev.Extensions.File.Data.Collection.Abstractions.
dotnet add package AlirezaMahDev.Extensions.File.Data.Collection.Abstractions --version 0.0.1-alpha7
                    
NuGet\Install-Package AlirezaMahDev.Extensions.File.Data.Collection.Abstractions -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.File.Data.Collection.Abstractions" 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.File.Data.Collection.Abstractions" Version="0.0.1-alpha7" />
                    
Directory.Packages.props
<PackageReference Include="AlirezaMahDev.Extensions.File.Data.Collection.Abstractions" />
                    
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.File.Data.Collection.Abstractions --version 0.0.1-alpha7
                    
#r "nuget: AlirezaMahDev.Extensions.File.Data.Collection.Abstractions, 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.File.Data.Collection.Abstractions@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.File.Data.Collection.Abstractions&version=0.0.1-alpha7&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=AlirezaMahDev.Extensions.File.Data.Collection.Abstractions&version=0.0.1-alpha7&prerelease
                    
Install as a Cake Tool

AlirezaMahDev.Extensions.File.Data.Collection.Abstractions

Project Description

This project defines the core abstractions and interfaces for the file-based collection system in the AlirezaMahDev.Extensions ecosystem. It provides the contract that concrete implementations must follow, ensuring a consistent API for working with file-based collections across different implementations.

Key Features

  • Type-Safe Interfaces: Strongly-typed interfaces for working with collections and objects
  • Extensible Design: Designed for extension while maintaining a consistent API
  • File-Based Operations: Abstractions for file-based data operations
  • Thread-Safe Operations: Designed with thread safety in mind
  • Asynchronous Support: Native support for async/await patterns

Core Interfaces

ICollectionAccess

The main entry point for working with collections, providing:

  • Access to collection objects
  • Basic collection management capabilities
  • Integration with the file system

ICollectionObjects

Represents a collection of objects with capabilities for:

  • Enumerating through collection items
  • Accessing objects by index
  • Managing the lifecycle of collection items

ICollectionObject

Represents an individual item within a collection with:

  • Property access and manipulation
  • Type conversion support
  • Change tracking
  • Serialization support

ICollectionProperties

Manages metadata and properties of collections:

  • Property definitions
  • Type information
  • Validation rules
  • Indexing options

Usage Example

// Define a service that works with collections
public class CollectionService
{
    private readonly ICollectionAccess _collectionAccess;

    public CollectionService(ICollectionAccess collectionAccess)
    {
        _collectionAccess = collectionAccess;
    }

    public async Task ProcessCollectionAsync()
    {
        // Get the objects collection
        var objects = _collectionAccess.Objects;

        // Process each object in the collection
        foreach (var obj in await objects.ToListAsync())
        {
            // Work with each collection object
            Console.WriteLine($"Processing object with ID: {obj.Id}");
        }
    }
}

Dependencies

Project Dependencies

  • AlirezaMahDev.Extensions.File.Data.Abstractions: Core file data access abstractions

Why This Dependency?

  • File.Data.Abstractions: Provides the fundamental interfaces and base classes for file-based data access that this project extends

Design Principles

  1. Interface Segregation: Small, focused interfaces for better maintainability
  2. Dependency Inversion: Depend on abstractions, not concrete implementations
  3. Separation of Concerns: Clear boundaries between different aspects of the collection system
  4. Extensibility: Designed to be extended without modifying existing code

Implementation Notes

  • All interfaces are designed to be thread-safe when implemented correctly
  • The API is designed to work well with dependency injection
  • Asynchronous operations are preferred for I/O-bound operations

Best Practices

  1. Dependency Injection: Always depend on interfaces, not concrete implementations
  2. Async/Await: Use async/await for all I/O operations
  3. Error Handling: Implement proper error handling in implementations
  4. Resource Management: Ensure proper disposal of resources
  5. Thread Safety: Implement thread safety in all public members

Extending the Abstractions

To create a custom implementation:

  1. Implement the core interfaces (ICollectionAccess, ICollectionObjects, etc.)
  2. Register your implementations with the DI container
  3. Ensure thread safety in your implementations
  4. Follow the contract defined by the interfaces
public class CustomCollectionAccess : ICollectionAccess
{
    // Implementation of ICollectionAccess members
    public ICollectionObjects Objects { get; }
    
    // Other implementation details
}

Error Handling

Implementations should throw appropriate exceptions:

  • InvalidOperationException for invalid operations
  • IOException for file system related errors
  • Custom exceptions for domain-specific error conditions

Thread Safety

All implementations of these interfaces should be thread-safe. The recommended pattern is to make all public members thread-safe while keeping internal operations as simple as possible.

Contributing

When contributing to this project, please ensure that:

  1. New interfaces follow the established patterns
  2. Documentation is kept up-to-date
  3. Changes maintain backward compatibility or follow semantic versioning for breaking changes
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 (2)

Showing the top 2 NuGet packages that depend on AlirezaMahDev.Extensions.File.Data.Collection.Abstractions:

Package Downloads
AlirezaMahDev.Extensions.File.Data.Table.Abstractions

Package Description

AlirezaMahDev.Extensions.File.Data.Collection

Package Description

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.0.1-alpha7 404 12/8/2025
0.0.1-alpha 275 12/7/2025