ApricotFramework.ObjectStore.DependencyInjection 0.1.0

Prefix Reserved
dotnet add package ApricotFramework.ObjectStore.DependencyInjection --version 0.1.0
                    
NuGet\Install-Package ApricotFramework.ObjectStore.DependencyInjection -Version 0.1.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="ApricotFramework.ObjectStore.DependencyInjection" Version="0.1.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="ApricotFramework.ObjectStore.DependencyInjection" Version="0.1.0" />
                    
Directory.Packages.props
<PackageReference Include="ApricotFramework.ObjectStore.DependencyInjection" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add ApricotFramework.ObjectStore.DependencyInjection --version 0.1.0
                    
#r "nuget: ApricotFramework.ObjectStore.DependencyInjection, 0.1.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package ApricotFramework.ObjectStore.DependencyInjection@0.1.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=ApricotFramework.ObjectStore.DependencyInjection&version=0.1.0
                    
Install as a Cake Addin
#tool nuget:?package=ApricotFramework.ObjectStore.DependencyInjection&version=0.1.0
                    
Install as a Cake Tool

ApricotFramework.ObjectStore

NuGet NuGet NuGet NuGet CI License

Object storage from .NET, configured the way a connection string is: named stores in one settings section, each binding one bucket and a key prefix. AWS S3 and any S3-compatible server work today, and a provider is a package, so adding another changes nothing about the stores you already have.

Callers address objects by key alone. The bucket, the endpoint, the prefix and the credentials stay in configuration, so moving a store to another bucket is a settings change.

ApricotFramework.ObjectStore is the zero-dependency core, and nothing here needs ASP.NET Core — the integration package depends only on Microsoft.Extensions.*, so a worker host can use it too.

Install

dotnet add package ApricotFramework.ObjectStore
dotnet add package ApricotFramework.ObjectStore.S3
dotnet add package ApricotFramework.ObjectStore.DependencyInjection
dotnet add package ApricotFramework.ObjectStore.ErrorDefinitions   # optional

Usage

builder.Services.AddObjectStores(builder.Configuration);
builder.Services.AddS3ObjectStoreProvider();
"ObjectStore": {
  "DefaultStore": "uploads",
  "Stores": {
    "uploads": {
      "Provider": "s3",
      "Settings": { "Bucket": "acme-uploads", "Region": "eu-west-1", "Prefix": "svc-a" }
    },
    "local": {
      "Provider": "s3",
      "Settings": { "Bucket": "dev", "ServiceUrl": "http://localhost:9000" }
      // Credentials come from the environment, never from this file:
      // ObjectStore__Stores__local__Settings__AccessKeyId
      // ObjectStore__Stores__local__Settings__SecretAccessKey
    }
  }
}

Any setting can be overridden from the environment (ObjectStore__Stores__uploads__Settings__Bucket). With no keys set, a store uses the AWS default credential chain, so a role or workload identity needs no configuration at all.

// the default store
app.MapPut("/files/{**key}", (IObjectStore store, string key, Stream body, CancellationToken ct) =>
    store.PutAsync(key, body, new ObjectPutOptions { ContentType = "text/plain" }, ct));

// a named store
app.MapGet("/avatar", ([FromKeyedServices("avatars")] IObjectStore avatars) => ...);

// or by name at runtime
var store = factory.GetStore("uploads");

A browser or a mobile app can upload and download without credentials or a trip through your service:

var upload = await store.CreateUploadUrlAsync("reports/q3.pdf", new PresignedUploadOptions { ContentType = "application/pdf" });
// hand upload.Url and upload.RequiredHeaders to the client; it sends them exactly as given

var form = await store.CreateUploadFormAsync("avatars/42.png", new PresignedPostOptions { MaximumSize = 1_000_000, ContentType = "image/png" });
// the only presigned upload the store itself holds to a size

Failures are exceptions of this library's own, with the vendor's error kept inside:

try { await store.GetAsync("missing.txt"); }
catch (ObjectNotFoundException) { /* ... */ }
catch (ObjectStoreException e) when (e.IsTransient()) { /* throttled, unreachable or timed out: retry */ }

With ApricotFramework.ErrorDefinitions in the host, services.AddObjectStoreErrorDefinitions() reports them as RFC 9457 problem+json — a missing object is a 404, a throttled store a 503 — without naming a bucket, an endpoint or a key.

Full documentation: https://projectapricot.dev/docs/object-store

Product 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.1.0 88 11/16/2026