Resourcefull.InMemory
3.0.0
See the version list below for details.
dotnet add package Resourcefull.InMemory --version 3.0.0
NuGet\Install-Package Resourcefull.InMemory -Version 3.0.0
<PackageReference Include="Resourcefull.InMemory" Version="3.0.0" />
<PackageVersion Include="Resourcefull.InMemory" Version="3.0.0" />
<PackageReference Include="Resourcefull.InMemory" />
paket add Resourcefull.InMemory --version 3.0.0
#r "nuget: Resourcefull.InMemory, 3.0.0"
#:package Resourcefull.InMemory@3.0.0
#addin nuget:?package=Resourcefull.InMemory&version=3.0.0
#tool nuget:?package=Resourcefull.InMemory&version=3.0.0
Resourcefull
Resourcefull stores and serves files of any type and size from infrastructure you run yourself. Upload, download, list and version resources in named containers through one client API, and keep the bytes in SQL Server, in memory for tests, or in a storage provider of your own.
| Package | What it's for |
|---|---|
Resourcefull |
The clients and the provider interface. |
Resourcefull.SqlServer |
Stores resources in SQL Server. |
Resourcefull.InMemory |
Keeps resources in process memory, for tests and local development. |
Features
- Any size: uploads and downloads stream, so memory use stays flat whatever the file size.
- Versioning: keep up to N versions of each resource, list them, download any of them, and restore an older one.
- Integrity: every version records its length and SHA-256 hash, measured as it's written. An upload whose declared length doesn't match its content is rejected, and nothing is stored.
- Safe under concurrency: each name always has exactly one current version, and create-only uploads can't overwrite each other.
- Your own storage: implement
IResourceRepositoryand register it withUseProvider.
Quick start
dotnet add package Resourcefull
dotnet add package Resourcefull.SqlServer # or Resourcefull.InMemory
Register Resourcefull with a provider, and provision the database:
builder.Services.AddResourcefull(options => options
.UseSqlServer(builder.Configuration.GetConnectionString("Resources")!)
.UseVersioning(maxVersions: 10));
var app = builder.Build();
await app.Services.MigrateResourcefullDatabaseAsync();
Then use IResourceServiceClient for containers, and a container client for the resources in one:
public class Reports(IResourceServiceClient resources)
{
public async Task<ResourceInfo> SaveAsync(string name, Stream content)
{
IResourceContainerClient reports = await resources.CreateResourceContainerIfNotExistsAsync("reports");
return await reports.UploadAsync(name, content, new ResourceUploadOptions
{
Overwrite = true,
Headers = new ResourceHeaders("application/pdf", null)
});
}
public async Task<ResourceDownloadResult?> OpenAsync(string name)
=> await resources.GetResourceContainerClient("reports").DownloadStreamingAsync(name);
}
Documentation
The documentation site has everything below, plus the API reference.
- Getting started
- Concepts: containers and names, uploads and downloads, versioning, concurrency, errors
- SQL Server: provisioning, permissions and upgrades
- ASP.NET Core recipes
- Upgrading to 3.0 and the changelog
- All documentation
Contributing
See CONTRIBUTING.md.
License
| 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
- Resourcefull (>= 3.0.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.