Dosaic.Plugins.Persistence.Smb
1.0.30
dotnet add package Dosaic.Plugins.Persistence.Smb --version 1.0.30
NuGet\Install-Package Dosaic.Plugins.Persistence.Smb -Version 1.0.30
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="Dosaic.Plugins.Persistence.Smb" Version="1.0.30" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Dosaic.Plugins.Persistence.Smb --version 1.0.30
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Dosaic.Plugins.Persistence.Smb, 1.0.30"
#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.
// Install Dosaic.Plugins.Persistence.Smb as a Cake Addin #addin nuget:?package=Dosaic.Plugins.Persistence.Smb&version=1.0.30 // Install Dosaic.Plugins.Persistence.Smb as a Cake Tool #tool nuget:?package=Dosaic.Plugins.Persistence.Smb&version=1.0.30
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Dosaic.Plugins.Persistence.Smb
Dosaic.Plugins.Persistence.Smb is a plugin
that allows other dosaic components
to do interact witha Smb compatible storage
.
Installation
To install the nuget package follow these steps:
dotnet add package Dosaic.Plugins.Persistence.Smb
or add as package reference to your .csproj
<PackageReference Include="Dosaic.Plugins.Persistence.Smb" Version="" />
Appsettings.yml
Configure your appsettings.yml with these properties
smb:
server: example.com
domain: mydomain.com
defaultShare: myshare
driveMappings:
- drive: 'J:'
share: myshare
shareMappings:
- folder: myfolder
share: myshare
Usage
public class ExampleService
{
private readonly ISmbStorage _smbStorage;
// retrieve the registered service ISmbStorage from the DI container via depentency injection
public ExampleService(ISmbStorage smbStorage)
{
_smbStorage = smbStorage;
}
// ensure a file exist in the smb storage
public async Task EnsurePathAsync()
{
await _fileStorage.EnsurePathAsync("folder/subfolder/", cancellationToken);
}
// delete a file from the smb storage
public async Task DeleteIfExists()
{
await _fileStorage.DeleteIfExists("folder/myfile.txt", cancellationToken);
}
// write a byte array as file content to the smb storage
public async Task WriteAsync()
{
await _fileStorage.WriteAsync("folder/myfile.txt", new byte[0], cancellationToken);
}
// write a string as file content to the smb storage
public async Task WriteStringAsync()
{
await _fileStorage.WriteStringAsync("folder/myfile.txt", "hello world", cancellationToken);
}
// write a stream as file content to the smb storage
public async Task WriteStreamAsync()
{
await _fileStorage.WriteStringAsync("folder/myfile.txt", new MemoryStream(), cancellationToken);
}
// read a file form smb storage and return content as string
public async Task ReadStringAsync()
{
string content = await ReadStreamAsync("folder/myfile.txt", cancellationToken);
}
// read a file form smb storage and return content as byte array
public async Task ReadBytesAsync()
{
bytes[] stream = await ReadStreamAsync("folder/myfile.txt", cancellationToken);
}
}
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. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net9.0
- Dosaic.Plugins.Persistence.Abstractions (>= 1.0.30)
- EzSmb (>= 1.3.10)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.