Talrace.Core.Storage
6.0.9
See the version list below for details.
dotnet add package Talrace.Core.Storage --version 6.0.9
NuGet\Install-Package Talrace.Core.Storage -Version 6.0.9
<PackageReference Include="Talrace.Core.Storage" Version="6.0.9" />
paket add Talrace.Core.Storage --version 6.0.9
#r "nuget: Talrace.Core.Storage, 6.0.9"
// Install Talrace.Core.Storage as a Cake Addin #addin nuget:?package=Talrace.Core.Storage&version=6.0.9 // Install Talrace.Core.Storage as a Cake Tool #tool nuget:?package=Talrace.Core.Storage&version=6.0.9
About
This package provides an API for working with file storages: Azure File Storage, Amazon S3, Google Cloud Storage, local storage.
Available api
IFileStorage - interface provides a set of methods for working with file storage.
UriExtensions - static class provides a set of Uri class extension methods for working with IFileStorage. Extension methods provide a wrapper around the IFileStorage functionality.
IAppPaths - interface provides functionality to get application paths for working with different file folders: "thumbs", "temp", "content".
IDateAdapter<T> - interface provides functionality to get current time with different types.
IFileHandler - interface provides a set of methods for file processing: saving and deleting files, getting relative, original and temporary file paths.
IUploadService<T, U, V> - interface provides functionality for uploading files. T is a class that inherits from IPostFile; U is a class that inherits from IFileInfo<V>. V is a type of Create Time.
Storage configuration (appsettings.json, environment variables, etc.)
Azure storage
{
"StorageConfiguration": {
"FilesPath": "<FilesPath>",
"AzureConnectionString": "<AzureConnectionString>"
}
}
Google storage
{
"StorageConfiguration": {
"FilesPath": "<FilesPath>",
"FileEndpoint": "<FileEndpoint>",
"GoogleKey": {
"type": "<Type>",
"project_id": "<ProjectId>",
"private_key_id": "<PrivateKeyId>",
"private_key": "<PrivateKey>",
"client_email": "<ClientEmail>",
"client_id": "<ClientId>",
"auth_uri": "<AuthUri>",
"token_uri": "<TokenUri>",
"auth_provider_x509_cert_url": "<AuthProvider>",
"client_x509_cert_url": "<ClientUrl>"
}
}
}
Amazon S3
{
"StorageConfiguration": {
"FilesPath": "<FilesPath>",
"AssessKeyId": "<AssessKeyId>",
"AssessKeySecret": "<AssessKeySecret>",
"Bucket": "<Bucket>"
}
}
Storage injection
Azure storage
public void ConfigureServices(IServiceCollection services) {
var storageConfiguration = Configuration.GetSection("StorageConfiguration");
services.AddAzureStorage(storageConfiguration);
}
Google storage
public void ConfigureServices(IServiceCollection services) {
var storageConfiguration = Configuration.GetSection("StorageConfiguration");
services.AddGoogleStorage(storageConfiguration);
}
Amazon S3
public void ConfigureServices(IServiceCollection services) {
var storageConfiguration = Configuration.GetSection("StorageConfiguration");
services.AddAwsS3Storage(storageConfiguration);
}
Local storage
public void ConfigureServices(IServiceCollection services) {
services.AddLocalStorage();
}
Core services
To use IAppPaths, IFileHandler and IUploadService<T, U, V>, you need to add these services to the dependency container by calling the AddCoreStorage method. Also you need to provide singleton implementation of IDateAdapter<V> or use long or DateTime implementation. Also you need to add IFileStorage to dependency container.
{
"StorageConfiguration": {
"FilesPath": "<FilesPath>"
}
}
Use unix create time
public void ConfigureServices(IServiceCollection services) {
var storageConfiguration = Configuration.GetSection("StorageConfiguration");
services.AddCoreStorage<long>(storageConfiguration);
// TODO: provide storage.
// For example: services.AddLocalStorage();
}
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
-
net6.0
- AWSSDK.S3 (>= 3.3.113.2)
- Azure.Storage.Files.Shares (>= 12.10.0)
- Google.Cloud.Storage.V1 (>= 3.7.0)
- Microsoft.Extensions.Configuration (>= 6.0.1)
- Microsoft.Extensions.DependencyInjection (>= 6.0.0)
- Microsoft.Extensions.Options (>= 6.0.0)
- Microsoft.Extensions.Options.ConfigurationExtensions (>= 6.0.0)
- Talrace.Core.Interfaces (>= 6.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 |
---|---|---|
8.0.0 | 1,373 | 11/30/2023 |
6.0.16 | 1,436 | 6/6/2023 |
6.0.15 | 394 | 4/21/2023 |
6.0.14 | 1,052 | 4/12/2023 |
6.0.13 | 195 | 3/28/2023 |
6.0.12 | 1,626 | 2/24/2023 |
6.0.11 | 228 | 2/24/2023 |
6.0.10 | 1,706 | 2/23/2023 |
6.0.9 | 472 | 2/22/2023 |
6.0.8 | 222 | 2/22/2023 |
6.0.7 | 235 | 2/21/2023 |
6.0.6 | 236 | 2/20/2023 |
6.0.5 | 233 | 2/15/2023 |
6.0.4 | 262 | 2/2/2023 |
6.0.3 | 305 | 1/30/2023 |
6.0.2 | 251 | 1/27/2023 |
6.0.1 | 1,684 | 5/5/2022 |
6.0.0 | 407 | 4/28/2022 |
3.1.19 | 302 | 9/24/2021 |
3.1.10 | 3,604 | 4/28/2021 |