Talrace.Core.Storage
6.0.7
See the version list below for details.
dotnet add package Talrace.Core.Storage --version 6.0.7
NuGet\Install-Package Talrace.Core.Storage -Version 6.0.7
<PackageReference Include="Talrace.Core.Storage" Version="6.0.7" />
paket add Talrace.Core.Storage --version 6.0.7
#r "nuget: Talrace.Core.Storage, 6.0.7"
// Install Talrace.Core.Storage as a Cake Addin
#addin nuget:?package=Talrace.Core.Storage&version=6.0.7
// Install Talrace.Core.Storage as a Cake Tool
#tool nuget:?package=Talrace.Core.Storage&version=6.0.7
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 - 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.
IUnixUploadService<T, U> - interface provides functionality for uploading files. T is a class that inherits from IPostFile; U is a class that inherits from IFileInfo with long type of Create time.
IDateTimeUploadService<T, U> - interface provides functionality for uploading files. T is a class that inherits from IPostFile; U is a class that inherits from IFileInfo with DateTime 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 AddUnixCoreStorage or AddDateTimeCoreStorage. 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.AddUnixCoreStorage(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 | 628 | 11/30/2023 |
6.0.16 | 1,341 | 6/6/2023 |
6.0.15 | 387 | 4/21/2023 |
6.0.14 | 1,046 | 4/12/2023 |
6.0.13 | 190 | 3/28/2023 |
6.0.12 | 1,618 | 2/24/2023 |
6.0.11 | 225 | 2/24/2023 |
6.0.10 | 1,697 | 2/23/2023 |
6.0.9 | 468 | 2/22/2023 |
6.0.8 | 217 | 2/22/2023 |
6.0.7 | 229 | 2/21/2023 |
6.0.6 | 231 | 2/20/2023 |
6.0.5 | 227 | 2/15/2023 |
6.0.4 | 250 | 2/2/2023 |
6.0.3 | 296 | 1/30/2023 |
6.0.2 | 244 | 1/27/2023 |
6.0.1 | 1,676 | 5/5/2022 |
6.0.0 | 400 | 4/28/2022 |
3.1.19 | 298 | 9/24/2021 |
3.1.10 | 3,595 | 4/28/2021 |