ManagedCode.Storage is a universal storage abstraction library that provides a consistent interface for working with multiple cloud blob storage providers including Azure Blob Storage, AWS S3, Google Cloud Storage, and local file system. The library aims to simplify development by providing a single API for all storage operations.
- ManagedCode.Storage.Core: Core abstractions and interfaces (IStorage, BaseStorage, etc.)
- Storages/: Provider-specific implementations
ManagedCode.Storage.Azure: Azure Blob Storage implementationManagedCode.Storage.Aws: AWS S3 implementationManagedCode.Storage.Google: Google Cloud Storage implementationManagedCode.Storage.FileSystem: Local file system implementationManagedCode.Storage.Sftp: FTP storage implementationManagedCode.Storage.Azure.DataLake: Azure Data Lake implementation
- Tests/: Unit and integration tests
- Integrations/: Additional integrations (SignalR, Client/Server components)
- Target Framework: .NET 9.0
- Language Version: C# 13
- Architecture: Provider pattern with unified interfaces
- Key Features: Async/await support, streaming operations, metadata handling, progress reporting
- Use nullable reference types (enabled in project)
- Follow async/await patterns consistently
- Use ValueTask for performance-critical operations where appropriate
- Implement proper cancellation token support in all async methods
- Use ConfigureAwait(false) for library code
- Follow dependency injection patterns
IStorage: Main storage interface for blob operationsIStorageOptions: Configuration options for storage providersBaseStorage: Base implementation with common functionality- All operations should support progress reporting via
IProgress<T> - Use
BlobMetadatafor storing blob metadata - Support for streaming operations with
IStreamer
- Implement efficient streaming for large files
- Use memory-efficient approaches for data transfer
- Cache metadata when appropriate
- Support parallel operations where beneficial
- Minimize allocations in hot paths
- Unit tests for core logic
- Integration tests for provider implementations
- Use test fakes/mocks for external dependencies
- Test error scenarios and edge cases
- Validate async operation behavior
When implementing new storage providers:
- Inherit from
BaseStorageclass - Implement all required interface methods
- Handle provider-specific errors appropriately
- Support all metadata operations
- Implement efficient streaming operations
- Add comprehensive tests
- Document provider-specific limitations or features
- Use appropriate exception types for different error scenarios
- Provide meaningful error messages
- Handle provider-specific errors and translate to common exceptions
- Support retry mechanisms where appropriate
- Document public APIs with XML comments
- Include usage examples for complex operations
- Document provider-specific behavior differences
- Keep README.md updated with supported features
- Create new project in
Storages/folder - Inherit from
BaseStorage - Implement provider-specific operations
- Add configuration options
- Create comprehensive tests
- Update solution file and documentation
- Define interface changes in Core project
- Update BaseStorage if needed
- Implement in all relevant providers
- Add tests for new functionality
- Update documentation
- Profile critical paths
- Optimize memory allocations
- Improve streaming performance
- Cache frequently accessed data
- Use efficient data structures
- Provider-specific SDKs (Azure.Storage.Blobs, AWS SDK, Google Cloud Storage)
- Microsoft.Extensions.* for dependency injection and configuration
- System.Text.Json for serialization
- Benchmarking tools for performance testing
- Use
dotnet buildto build the solution - Run
dotnet testfor unit tests - Integration tests may require cloud provider credentials
- Use
dotnet packto create NuGet packages