ArrowDb.DependencyInjection
2.0.0
dotnet add package ArrowDb.DependencyInjection --version 2.0.0
NuGet\Install-Package ArrowDb.DependencyInjection -Version 2.0.0
<PackageReference Include="ArrowDb.DependencyInjection" Version="2.0.0" />
<PackageVersion Include="ArrowDb.DependencyInjection" Version="2.0.0" />
<PackageReference Include="ArrowDb.DependencyInjection" />
paket add ArrowDb.DependencyInjection --version 2.0.0
#r "nuget: ArrowDb.DependencyInjection, 2.0.0"
#:package ArrowDb.DependencyInjection@2.0.0
#addin nuget:?package=ArrowDb.DependencyInjection&version=2.0.0
#tool nuget:?package=ArrowDb.DependencyInjection&version=2.0.0
ArrowDb.DependencyInjection
Dependency injection support for ArrowDb.
This package provides IArrowDbProvider, the public generic ArrowDbProvider<TSerializer>, and an optional hosted-service primer for eager startup initialization.
Install
dotnet add package ArrowDb.DependencyInjection
Register
builder.Services.AddSingleton(new FileSerializer(path, ArrowDbJsonContext.Default.ConcurrentDictionaryStringByteArray));
builder.Services.AddSingleton<IArrowDbProvider, ArrowDbProvider<FileSerializer>>();
For AES-backed storage:
builder.Services.AddSingleton(_ => Aes.Create());
builder.Services.AddSingleton(serviceProvider =>
new AesFileSerializer(
path,
serviceProvider.GetRequiredService<Aes>(),
ArrowDbJsonContext.Default.ConcurrentDictionaryStringByteArray));
builder.Services.AddSingleton<IArrowDbProvider, ArrowDbProvider<AesFileSerializer>>();
If you want eager host-startup initialization for a singleton provider, also add:
builder.Services.AddArrowDbInitialization();
Consume
public sealed class MyService {
private readonly IArrowDbProvider _provider;
public MyService(IArrowDbProvider provider) {
_provider = provider;
}
public async Task<int> CountAsync() {
ArrowDb db = await _provider.GetAsync();
return db.Count;
}
}
ArrowDbProvider<TSerializer> does not dispose the serializer by default. That fits the common DI case where the serializer is registered separately and the container owns it.
If you want the provider to own the serializer lifetime instead, register it with a factory and pass disposeSerializer: true:
builder.Services.AddSingleton<IArrowDbProvider>(_ =>
new ArrowDbProvider<FileSerializer>(
new FileSerializer(path, ArrowDbJsonContext.Default.ConcurrentDictionaryStringByteArray),
disposeSerializer: true));
If you register the provider as a singleton and add AddArrowDbInitialization(), the host will prime it during startup.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. 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
- ArrowDb (>= 2.0.0)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 10.0.5)
- Microsoft.Extensions.Hosting.Abstractions (>= 10.0.5)
-
net9.0
- ArrowDb (>= 2.0.0)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 10.0.5)
- Microsoft.Extensions.Hosting.Abstractions (>= 10.0.5)
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 |
|---|---|---|
| 2.0.0 | 37 | 4/14/2026 |