Feature: File System Provider (ManagedCode.Storage.FileSystem)
Purpose
Implement IStorage on top of the local file system so you can use the same abstraction in production code, local development, and tests:
- local development
- on-prem/hybrid deployments
- tests and demos
Main Flows
flowchart LR
App --> FS[FileSystemStorage : IFileSystemStorage]
FS --> IO[System.IO]
IO --> Disk[(Disk)]
Components
Storages/ManagedCode.Storage.FileSystem/FileSystemStorage.csStorages/ManagedCode.Storage.FileSystem/FileSystemStorageProvider.cs- DI:
- Options:
DI Wiring
dotnet add package ManagedCode.Storage.FileSystem
using ManagedCode.Storage.FileSystem.Extensions;
builder.Services.AddFileSystemStorageAsDefault(options =>
{
options.BaseFolder = Path.Combine(builder.Environment.ContentRootPath, "storage");
});
Current Behavior
BaseFolderacts as the container root.- Supports directory creation when
CreateContainerIfNotExists = true.
Tests
Tests/ManagedCode.Storage.Tests/Storages/FileSystem/FileSystemUploadTests.csTests/ManagedCode.Storage.Tests/Storages/FileSystem/FileSystemDownloadTests.csTests/ManagedCode.Storage.Tests/Storages/FileSystem/FileSystemBlobTests.csTests/ManagedCode.Storage.Tests/Storages/FileSystem/FileSystemContainerTests.csTests/ManagedCode.Storage.Tests/Storages/FileSystem/FileSystemSecurityTests.cs