![]() |
VOOZH | about |
dotnet add package Dosaic.Plugins.Persistence.Smb --version 1.2.35
NuGet\Install-Package Dosaic.Plugins.Persistence.Smb -Version 1.2.35
<PackageReference Include="Dosaic.Plugins.Persistence.Smb" Version="1.2.35" />
<PackageVersion Include="Dosaic.Plugins.Persistence.Smb" Version="1.2.35" />Directory.Packages.props
<PackageReference Include="Dosaic.Plugins.Persistence.Smb" />Project file
paket add Dosaic.Plugins.Persistence.Smb --version 1.2.35
#r "nuget: Dosaic.Plugins.Persistence.Smb, 1.2.35"
#:package Dosaic.Plugins.Persistence.Smb@1.2.35
#addin nuget:?package=Dosaic.Plugins.Persistence.Smb&version=1.2.35Install as a Cake Addin
#tool nuget:?package=Dosaic.Plugins.Persistence.Smb&version=1.2.35Install as a Cake Tool
Dosaic.Plugins.Persistence.Smb is a plugin that provides SMB/CIFS (Samba) file storage for Dosaic applications. It exposes an ISmbStorage abstraction for reading, writing, deleting, and managing files and folders on SMB-compatible network shares, with support for drive mappings, share mappings, and automatic path resolution.
dotnet add package Dosaic.Plugins.Persistence.Smb
Or add as a package reference to your .csproj:
<PackageReference Include="Dosaic.Plugins.Persistence.Smb" Version="" />
The plugin binds its configuration from the smb section (via [Configuration("smb")]).
smb:
server: example.com
domain: mydomain.com
username: smbuser
password: s3cr3t
defaultShare: myshare
driveMappings:
- drive: 'J:'
share: docs
- drive: 'K:'
share: archive
shareMappings:
- folder: Reports
share: reports-share
- folder: Uploads
share: uploads-share
| Property | Type | Description |
|---|---|---|
server |
string |
Hostname or IP address of the SMB server |
domain |
string |
Windows domain for authentication |
username |
string |
SMB username |
password |
string |
SMB password |
defaultShare |
string |
Fallback share used when no mapping matches |
driveMappings |
DriveMapping[] |
Map Windows drive letters (e.g. J:) to share names |
shareMappings |
PathMapping[] |
Map path prefixes (folders) to specific share names |
J:\Reports\file.pdf), the drive is replaced with the corresponding share.Reports\file.pdf), that prefix is replaced with the corresponding share.defaultShare is used.SmbStoragePlugin implements IPluginServiceConfiguration and is discovered automatically by the Dosaic source generator. It registers ISmbStorage as a singleton in the DI container. Ensure the configuration section is present in your appsettings.yml.
ISmbStoragepublic class DocumentService(ISmbStorage smbStorage)
{
private readonly ISmbStorage _smbStorage = smbStorage;
}
// Write raw bytes
byte[] pdfBytes = File.ReadAllBytes("local.pdf");
await _smbStorage.WriteAsync("Reports/Q1/report.pdf", pdfBytes, cancellationToken);
// Write a UTF-8 string (extension method)
await _smbStorage.WriteStringAsync("Logs/app.log", "Application started", cancellationToken);
// Write a stream (extension method)
await using var fileStream = File.OpenRead("photo.jpg");
await _smbStorage.WriteStreamAsync("Photos/photo.jpg", fileStream, cancellationToken);
// Read as a Stream
await using var stream = await _smbStorage.ReadStreamAsync("Reports/Q1/report.pdf", cancellationToken);
// Read as a string (extension method)
string logContent = await _smbStorage.ReadStringAsync("Logs/app.log", cancellationToken);
// Read as a byte array (extension method)
byte[] data = await _smbStorage.ReadBytesAsync("Reports/Q1/report.pdf", cancellationToken);
EnsurePathAsync traverses each segment of the path and creates any missing folders recursively.
await _smbStorage.EnsurePathAsync("Reports/2025/Q1/", cancellationToken);
DeleteIfExists silently ignores the case where the file does not exist. It throws a DosaicException if the file is found but cannot be deleted.
await _smbStorage.DeleteIfExists("Reports/Q1/old-report.pdf", cancellationToken);
// With a drive mapping: J: -> docs-share
await _smbStorage.WriteAsync(@"J:\Invoices\2025\inv001.pdf", data, cancellationToken);
// Resolves to: \\example.com\docs-share\Invoices\2025\inv001.pdf
// With a share mapping: Uploads -> uploads-share
await _smbStorage.WriteAsync("Uploads/avatars/user42.png", data, cancellationToken);
// Resolves to: \\example.com\uploads-share\avatars\user42.png
ISmbStorage abstraction — decouples application code from the concrete SMB implementation; easy to mock in tests/) and backslashes (\) are interchangeable in all path argumentsEnsurePathAsync — recursively creates missing folders on the SMB shareDeleteIfExists — idempotent deletion; no error when the target is already absentWriteStringAsync, WriteStreamAsync, ReadStringAsync, ReadBytesAsync available on any ISmbStorage instancedosaic_persistence_smb_writes_totaldosaic_persistence_smb_reads_totaldosaic_persistence_smb_deletes_total| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 net10.0 is compatible. net10.0-android net10.0-android was computed. net10.0-browser net10.0-browser was computed. net10.0-ios net10.0-ios was computed. net10.0-maccatalyst net10.0-maccatalyst was computed. net10.0-macos net10.0-macos was computed. net10.0-tvos net10.0-tvos was computed. net10.0-windows net10.0-windows was computed. |
This package is not used by any NuGet packages.
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.2.35 | 0 | 6/19/2026 |
| 1.2.34 | 98 | 6/10/2026 |
| 1.2.33 | 100 | 6/2/2026 |
| 1.2.31 | 103 | 5/28/2026 |
| 1.2.30 | 109 | 5/7/2026 |
| 1.2.29 | 101 | 5/5/2026 |
| 1.2.28 | 96 | 4/30/2026 |
| 1.2.27 | 104 | 4/29/2026 |
| 1.2.26 | 98 | 4/29/2026 |
| 1.2.25 | 101 | 4/27/2026 |
| 1.2.24 | 108 | 4/21/2026 |
| 1.2.23 | 114 | 4/14/2026 |
| 1.2.22 | 107 | 4/10/2026 |
| 1.2.21 | 103 | 4/10/2026 |
| 1.2.20 | 101 | 4/10/2026 |
| 1.2.19 | 105 | 4/9/2026 |
| 1.2.18 | 109 | 4/2/2026 |
| 1.2.17 | 106 | 4/1/2026 |
| 1.2.16 | 108 | 4/1/2026 |
| 1.2.15 | 117 | 3/31/2026 |