This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
- Build:
dotnet build- Builds the entire solution - Restore:
dotnet restore- Restores NuGet packages - Test:
dotnet test- Runs all tests - Test with Coverage:
dotnet test /p:CollectCoverage=true /p:CoverletOutput=coverage /p:CoverletOutputFormat=opencover
- Run single test project:
dotnet test Tests/ManagedCode.Storage.Tests/ManagedCode.Storage.Tests.csproj - Run specific test:
dotnet test --filter "ClassName.MethodName"
This is a .NET 9 solution targeting multiple cloud storage providers with a universal interface.
The solution follows a provider pattern with:
-
Core Library (
ManagedCode.Storage.Core): Base interfaces and abstract classesIStorage<T, TOptions>: Generic storage interface with client and optionsBaseStorage<T, TOptions>: Abstract base implementation- Common models:
BlobMetadata,UploadOptions,DownloadOptions, etc.
-
Storage Providers (in
Storages/directory):ManagedCode.Storage.Azure: Azure Blob StorageManagedCode.Storage.Azure.DataLake: Azure Data Lake StorageManagedCode.Storage.Aws: Amazon S3ManagedCode.Storage.Google: Google Cloud StorageManagedCode.Storage.FileSystem: Local file system
-
Integrations (in
Integraions/directory):ManagedCode.Storage.Server: ASP.NET Core extensionsManagedCode.Storage.Client: Client SDKManagedCode.Storage.Client.SignalR: SignalR integration
IStorage: Main storage interface combining uploader, downloader, streamer, and operationsIUploader: File upload operationsIDownloader: File download operationsIStreamer: Stream-based operationsIStorageOperations: Blob metadata and existence operations
The library supports two connection modes:
- Default mode: Use
IStorageinterface (single provider) - Provider-specific mode: Use provider-specific interfaces like
IAzureStorage,IAWSStorage
IStorageFactory: Creates storage instancesIStorageProvider: Provider registration interface- Extension methods for DI registration (e.g.,
AddAzureStorage,AddAWSStorageAsDefault)
- Uses xUnit with Shouldly
- Testcontainers for integration testing (Azurite, LocalStack, FakeGcsServer)
- Test projects follow pattern:
Tests/ManagedCode.Storage.Tests/ - Includes test fakes in
ManagedCode.Storage.TestFakes
- All providers inherit from
BaseStorage<T, TOptions> - Options classes implement
IStorageOptions - Result pattern using
ManagedCode.Communication.Result<T> - Async/await throughout with CancellationToken support
- Dependency injection via extension methods
// Upload
await storage.UploadAsync(stream, options => {
options.FileName = "file.txt";
options.MimeType = "text/plain";
});
// Download
var file = await storage.DownloadAsync("file.txt");
// Delete
await storage.DeleteAsync("file.txt");
// Check existence
var exists = await storage.ExistsAsync("file.txt");