VOOZH about

URL: https://www.nuget.org/packages/ManagedCode.Storage.AspNetExtensions/2.0.15

⇱ NuGet Gallery | ManagedCode.Storage.AspNetExtensions 2.0.15




👁 Image
ManagedCode.Storage.AspNetExtensions 2.0.15

Prefix Reserved
There is a newer version of this package available.
See the version list below for details.
dotnet add package ManagedCode.Storage.AspNetExtensions --version 2.0.15
 
 
NuGet\Install-Package ManagedCode.Storage.AspNetExtensions -Version 2.0.15
 
 
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="ManagedCode.Storage.AspNetExtensions" Version="2.0.15" />
 
 
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="ManagedCode.Storage.AspNetExtensions" Version="2.0.15" />
 
Directory.Packages.props
<PackageReference Include="ManagedCode.Storage.AspNetExtensions" />
 
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add ManagedCode.Storage.AspNetExtensions --version 2.0.15
 
 
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: ManagedCode.Storage.AspNetExtensions, 2.0.15"
 
 
#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.
#:package ManagedCode.Storage.AspNetExtensions@2.0.15
 
 
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=ManagedCode.Storage.AspNetExtensions&version=2.0.15
 
Install as a Cake Addin
#tool nuget:?package=ManagedCode.Storage.AspNetExtensions&version=2.0.15
 
Install as a Cake Tool
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

👁 img|300x200

ManagedCode.Storage

👁 .NET
👁 Coverage Status
👁 nuget
👁 CodeQL

Version Package Description
👁 NuGet Package
ManagedCode.Storage.Core Core
👁 NuGet Package
ManagedCode.Storage.FileSystem FileSystem
👁 NuGet Package
ManagedCode.Storage.Azure Azure
👁 NuGet Package
ManagedCode.Storage.Aws AWS
👁 NuGet Package
ManagedCode.Storage.Gcp GCP
👁 NuGet Package
ManagedCode.Storage.AspNetExtensions AspNetExtensions

Storage


Storage pattern implementation for C#.

A universal storage for working with multiple storage providers:

  • Azure
  • Google Cloud
  • Amazon
  • FileSystem

General concept

The library incapsulates all provider specific to make connection and managing storages as easy as possible. You have as customer just connect the library in your Startup providing necessary connection strings and inject needed interfaces in your services.

Connection modes

You can connect storage interface in two modes provider-specific and default. In case of default you are restricted with one storage type

Azure

Default mode connection:

// Startup.cs
services.AddAzureStorageAsDefault(new AzureStorageOptions
{
 Container = "{YOUR_CONTAINER_NAME}",
 ConnectionString = "{YOUR_CONNECTION_NAME}",
});

Using in default mode:

// MyService.cs
public class MyService
{
 private readonly IStorage _storage;

 public MyService(IStorage storage)
 {
 _storage = storage;
 }
}

Provider-specific mode connection:

// Startup.cs
services.AddAzureStorage(new AzureStorageOptions
{
 Container = "{YOUR_CONTAINER_NAME}",
 ConnectionString = "{YOUR_CONNECTION_NAME}",
});

Using in provider-specific mode

// MyService.cs
public class MyService
{
 private readonly IAzureStorage _azureStorage;

 public MyService(IAzureStorage azureStorage)
 {
 _azureStorage = azureStorage;
 }
}

<details> <summary>Google Cloud (Click here to expand)</summary>

Google Cloud

Default mode connection:

// Startup.cs
services.AddGCPStorageAsDefault(opt =>
{
 opt.GoogleCredential = GoogleCredential.FromFile("{PATH_TO_YOUR_CREDENTIALS_FILE}.json");

 opt.BucketOptions = new BucketOptions()
 {
 ProjectId = "{YOUR_API_PROJECT_ID}",
 Bucket = "{YOUR_BUCKET_NAME}",
 };
});

Using in default mode:

// MyService.cs
public class MyService
{
 private readonly IStorage _storage;
 
 public MyService(IStorage storage)
 {
 _storage = storage;
 }
}

Provider-specific mode connection:

// Startup.cs
services.AddGCPStorage(new GCPStorageOptions
{
 BucketOptions = new BucketOptions()
 {
 ProjectId = "{YOUR_API_PROJECT_ID}",
 Bucket = "{YOUR_BUCKET_NAME}",
 }
});

Using in provider-specific mode

// MyService.cs
public class MyService
{
 private readonly IGCPStorage _gcpStorage;
 public MyService(IGCPStorage gcpStorage)
 {
 _gcpStorage = gcpStorage;
 }
}

</details>

<details> <summary>Amazon (Click here to expand)</summary>

Amazon

Default mode connection:

// Startup.cs
//aws libarary overwrites property values. you should only create configurations this way. 
var awsConfig = new AmazonS3Config();
awsConfig.RegionEndpoint = RegionEndpoint.EUWest1;
awsConfig.ForcePathStyle = true;
awsConfig.UseHttp = true;
awsConfig.ServiceURL = "http://localhost:4566"; //this is the default port for the aws s3 emulator, must be last in the list

services.AddAWSStorageAsDefault(opt =>
{
 opt.PublicKey = "{YOUR_PUBLIC_KEY}";
 opt.SecretKey = "{YOUR_SECRET_KEY}";
 opt.Bucket = "{YOUR_BUCKET_NAME}";
 opt.OriginalOptions = awsConfig;
});

Using in default mode:

// MyService.cs
public class MyService
{
 private readonly IStorage _storage;
 
 public MyService(IStorage storage)
 {
 _storage = storage;
 }
}

Provider-specific mode connection:

// Startup.cs
services.AddAWSStorage(new AWSStorageOptions
{
 PublicKey = "{YOUR_PUBLIC_KEY}",
 SecretKey = "{YOUR_SECRET_KEY}",
 Bucket = "{YOUR_BUCKET_NAME}",
 OriginalOptions = awsConfig
});

Using in provider-specific mode

// MyService.cs
public class MyService
{
 private readonly IAWSStorage _gcpStorage;
 public MyService(IAWSStorage gcpStorage)
 {
 _gcpStorage = gcpStorage;
 }
}

</details>

<details> <summary>FileSystem (Click here to expand)</summary>

FileSystem

Default mode connection:

// Startup.cs
services.AddFileSystemStorageAsDefault(opt =>
{
 opt.BaseFolder = Path.Combine(Environment.CurrentDirectory, "{YOUR_BUCKET_NAME}");
});

Using in default mode:

// MyService.cs
public class MyService
{
 private readonly IStorage _storage;
 
 public MyService(IStorage storage)
 {
 _storage = storage;
 }
}

Provider-specific mode connection:

// Startup.cs
services.AddFileSystemStorage(new FileSystemStorageOptions
{
 BaseFolder = Path.Combine(Environment.CurrentDirectory, "{YOUR_BUCKET_NAME}"),
});

Using in provider-specific mode

// MyService.cs
public class MyService
{
 private readonly IFileSystemStorage _fileSystemStorage;
 public MyService(IFileSystemStorage fileSystemStorage)
 {
 _fileSystemStorage = fileSystemStorage;
 }
}

</details>

How to use

We assume that below code snippets are placed in your service class with injected IStorage:

public class MyService
{
 private readonly IStorage _storage;
 public MyService(IStorage storage)
 {
 _storage = storage;
 }
}

Upload

await _storage.UploadAsync(new Stream());
await _storage.UploadAsync("some string content");
await _storage.UploadAsync(new FileInfo("D:\\my_report.txt"));

Delete

await _storage.DeleteAsync("my_report.txt");

Download

var localFile = await _storage.DownloadAsync("my_report.txt");

Get metadata

await _storage.GetBlobMetadataAsync("my_report.txt");

Native client

If you need more flexibility, you can use native client for any IStorage<T>

_storage.StorageClient
Product Versions Compatible and additional computed target framework versions.
.NET net5.0 net5.0 was computed.  net5.0-windows net5.0-windows was computed.  net6.0 net6.0 was computed.  net6.0-android net6.0-android was computed.  net6.0-ios net6.0-ios was computed.  net6.0-maccatalyst net6.0-maccatalyst was computed.  net6.0-macos net6.0-macos was computed.  net6.0-tvos net6.0-tvos was computed.  net6.0-windows net6.0-windows was computed.  net7.0 net7.0 was computed.  net7.0-android net7.0-android was computed.  net7.0-ios net7.0-ios was computed.  net7.0-maccatalyst net7.0-maccatalyst was computed.  net7.0-macos net7.0-macos was computed.  net7.0-tvos net7.0-tvos was computed.  net7.0-windows net7.0-windows was computed.  net8.0 net8.0 was computed.  net8.0-android net8.0-android was computed.  net8.0-browser net8.0-browser was computed.  net8.0-ios net8.0-ios was computed.  net8.0-maccatalyst net8.0-maccatalyst was computed.  net8.0-macos net8.0-macos was computed.  net8.0-tvos net8.0-tvos was computed.  net8.0-windows net8.0-windows was computed.  net9.0 net9.0 was computed.  net9.0-android net9.0-android was computed.  net9.0-browser net9.0-browser was computed.  net9.0-ios net9.0-ios was computed.  net9.0-maccatalyst net9.0-maccatalyst was computed.  net9.0-macos net9.0-macos was computed.  net9.0-tvos net9.0-tvos was computed.  net9.0-windows net9.0-windows was computed.  net10.0 net10.0 was computed.  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. 
.NET Core netcoreapp2.0 netcoreapp2.0 was computed.  netcoreapp2.1 netcoreapp2.1 was computed.  netcoreapp2.2 netcoreapp2.2 was computed.  netcoreapp3.0 netcoreapp3.0 was computed.  netcoreapp3.1 netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 netstandard2.0 is compatible.  netstandard2.1 netstandard2.1 was computed. 
.NET Framework net461 net461 was computed.  net462 net462 was computed.  net463 net463 was computed.  net47 net47 was computed.  net471 net471 was computed.  net472 net472 was computed.  net48 net48 was computed.  net481 net481 was computed. 
MonoAndroid monoandroid monoandroid was computed. 
MonoMac monomac monomac was computed. 
MonoTouch monotouch monotouch was computed. 
Tizen tizen40 tizen40 was computed.  tizen60 tizen60 was computed. 
Xamarin.iOS xamarinios xamarinios was computed. 
Xamarin.Mac xamarinmac xamarinmac was computed. 
Xamarin.TVOS xamarintvos xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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.1.14 1,438 5/21/2023
2.1.13 5,905 12/20/2022
2.1.11 698 10/18/2022
2.1.10 561 10/18/2022
2.1.9 557 10/18/2022
2.1.8 530 10/18/2022
2.1.7 571 10/18/2022
2.1.6 572 10/18/2022
2.1.5 564 10/17/2022
2.1.4 566 10/17/2022
2.1.3 564 10/17/2022
2.1.2 587 10/16/2022
2.1.1 525 10/16/2022
2.1.0 578 10/14/2022
2.0.18 587 10/14/2022
2.0.17 551 10/14/2022
2.0.16 579 10/14/2022
2.0.15 561 10/14/2022
2.0.14 556 10/14/2022
Loading failed