AlirezaMahDev.Extensions.File.Data.Collection.Abstractions
0.0.1-alpha
See the version list below for details.
dotnet add package AlirezaMahDev.Extensions.File.Data.Collection.Abstractions --version 0.0.1-alpha
NuGet\Install-Package AlirezaMahDev.Extensions.File.Data.Collection.Abstractions -Version 0.0.1-alpha
<PackageReference Include="AlirezaMahDev.Extensions.File.Data.Collection.Abstractions" Version="0.0.1-alpha" />
<PackageVersion Include="AlirezaMahDev.Extensions.File.Data.Collection.Abstractions" Version="0.0.1-alpha" />
<PackageReference Include="AlirezaMahDev.Extensions.File.Data.Collection.Abstractions" />
paket add AlirezaMahDev.Extensions.File.Data.Collection.Abstractions --version 0.0.1-alpha
#r "nuget: AlirezaMahDev.Extensions.File.Data.Collection.Abstractions, 0.0.1-alpha"
#:package AlirezaMahDev.Extensions.File.Data.Collection.Abstractions@0.0.1-alpha
#addin nuget:?package=AlirezaMahDev.Extensions.File.Data.Collection.Abstractions&version=0.0.1-alpha&prerelease
#tool nuget:?package=AlirezaMahDev.Extensions.File.Data.Collection.Abstractions&version=0.0.1-alpha&prerelease
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
- Interface Segregation: Small, focused interfaces for better maintainability
- Dependency Inversion: Depend on abstractions, not concrete implementations
- Separation of Concerns: Clear boundaries between different aspects of the collection system
- 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
- Dependency Injection: Always depend on interfaces, not concrete implementations
- Async/Await: Use async/await for all I/O operations
- Error Handling: Implement proper error handling in implementations
- Resource Management: Ensure proper disposal of resources
- Thread Safety: Implement thread safety in all public members
Extending the Abstractions
To create a custom implementation:
- Implement the core interfaces (
ICollectionAccess,ICollectionObjects, etc.) - Register your implementations with the DI container
- Ensure thread safety in your implementations
- 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:
InvalidOperationExceptionfor invalid operationsIOExceptionfor 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:
- New interfaces follow the established patterns
- Documentation is kept up-to-date
- Changes maintain backward compatibility or follow semantic versioning for breaking changes
| Product | Versions 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. |
-
net10.0
- AlirezaMahDev.Extensions.File.Data.Abstractions (>= 0.0.1-alpha)
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 |