StorageConnector 10.0.0

dotnet add package StorageConnector --version 10.0.0
                    
NuGet\Install-Package StorageConnector -Version 10.0.0
                    
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="StorageConnector" Version="10.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="StorageConnector" Version="10.0.0" />
                    
Directory.Packages.props
<PackageReference Include="StorageConnector" />
                    
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 StorageConnector --version 10.0.0
                    
#r "nuget: StorageConnector, 10.0.0"
                    
#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 StorageConnector@10.0.0
                    
#: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=StorageConnector&version=10.0.0
                    
Install as a Cake Addin
#tool nuget:?package=StorageConnector&version=10.0.0
                    
Install as a Cake Tool

StorageConnector

NuGet NuGet Downloads License: GPL v3 .NET

A unified interface for multi-cloud storage operations - StorageConnector is an open-source C# library that provides a consistent abstraction layer for cloud storage services, enabling seamless integration with Azure Blob Storage, AWS S3, and Google Cloud Storage.


✨ Features

  • 🌐 Multi-Cloud Support - Azure Blob Storage, AWS S3, and Google Cloud Storage
  • 🔐 Pre-Signed URLs - Generate secure direct upload/download URLs for client-side operations
  • 🌍 Geographic Routing - Route storage operations based on country ISO codes for data residency compliance
  • 🤖 AI Integration - Built-in facial recognition support (Azure Face API, AWS Rekognition)
  • 💉 Dependency Injection - First-class support for ASP.NET Core DI
  • 🎯 Type Safety - Strongly-typed configuration and DTOs
  • 📦 Easy Configuration - Simple JSON-based configuration

📦 Installation

NuGet Package

Install via .NET CLI:

dotnet add package StorageConnector

Or via Package Manager Console:

Install-Package StorageConnector

Package Links:


🚀 Quick Start

1. Configure Services

Add StorageConnector to your Program.cs or Startup.cs:

builder.Services.AddStorageConnector(builder.Configuration);

2. Configuration

Add the following to your appsettings.json:

⚠️ Security Warning: Never commit real credentials to source control. Use environment variables, Azure Key Vault, AWS Secrets Manager, or similar secure storage for production credentials.

{
  "StorageConnectors": {
    "Azure": {
      "CountryIsoCodeMapToAccountName": {
        "US": "yourstorageaccount"
      },
      "Accounts": [
        {
          "AccountName": "yourstorageaccount",
          "AccountKey": "YOUR_AZURE_STORAGE_ACCOUNT_KEY",
          "ContainerName": "your-container-name"
        }
      ]
    },
    "AWS": {
      "AwsCredentials": {
        "AccessKey": "YOUR_AWS_ACCESS_KEY",
        "SecretAccessKey": "YOUR_AWS_SECRET_KEY"
      },
      "CountryIsoCodeMapToAccountName": {
        "EU": "your-s3-bucket"
      },
      "Accounts": [
        {
          "BucketName": "your-s3-bucket",
          "AwsRegion": "eu-west-1",
          "AwsCredentials": {
            "AccessKey": "YOUR_AWS_ACCESS_KEY",
            "SecretAccessKey": "YOUR_AWS_SECRET_KEY"
          }
        }
      ]
    },
    "GCP": {
      "GcpCredentials": {
        "type": "service_account",
        "project_id": "your-project-id",
        "private_key_id": "YOUR_PRIVATE_KEY_ID",
        "private_key": "-----BEGIN PRIVATE KEY-----\nYOUR_PRIVATE_KEY\n-----END PRIVATE KEY-----\n",
        "client_email": "your-service-account@your-project.iam.gserviceaccount.com",
        "client_id": "YOUR_CLIENT_ID",
        "auth_uri": "https://accounts.google.com/o/oauth2/auth",
        "token_uri": "https://oauth2.googleapis.com/token",
        "auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
        "client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/your-service-account%40your-project.iam.gserviceaccount.com",
        "universe_domain": "googleapis.com"
      },
      "CountryIsoCodeMapToAccountName": {
        "IN": "your-gcp-bucket"
      },
      "Accounts": [
        {
          "BucketName": "your-gcp-bucket",
          "ServiceAccountEmail": "your-service-account@your-project.iam.gserviceaccount.com"
        }
      ]
    }
  }
}

3. Usage Example

Inject StorageConnectorService into your classes:

using StorageConnector;
using EarthCountriesInfo;

public class FileUploadController : ControllerBase
{
    private readonly StorageConnectorService _storageConnectorService;

    public FileUploadController(StorageConnectorService storageConnectorService)
    {
        _storageConnectorService = storageConnectorService;
    }

    [HttpPost("generate-upload-url")]
    public async Task<IActionResult> GenerateUploadUrl([FromBody] UploadRequest request)
    {
        // Generate a pre-signed upload URL for client-side upload
        var uploadInfo = await _storageConnectorService.GenerateDirectUploadInfo(
            countryOfResidenceIsoCode: CountryIsoCode.US,
            fileReferenceWithPath: new CloudFileName($"uploads/{Guid.NewGuid()}"),
            contentType: "image/png",
            expiryInMinutes: 15
        );

        return Ok(uploadInfo);
    }
}

Response Model:

public sealed record UploadInfo
{
    [JsonPropertyName("directUploadUrl")]
    public required string DirectUploadUrl { get; init; }
    
    [JsonPropertyName("method")]
    public required string HttpMethod { get; init; }

    [JsonPropertyName("headers")]
    public required Dictionary<string, string> Headers { get; init; }
}

📖 Key Concepts

Country-Based Routing

StorageConnector can route files to different storage accounts based on country ISO codes, helping you comply with data residency requirements (GDPR, etc.):

// Files from EU users go to EU storage
var uploadInfo = await _storageConnectorService.GenerateDirectUploadInfo(
    CountryIsoCode.DE, // Germany
    new CloudFileName("user-data/profile.jpg"),
    "image/jpeg"
);

Direct Upload/Download

Generate pre-signed URLs to allow clients to upload/download directly to/from cloud storage without routing through your server:

// Generate upload URL (client uploads directly to cloud)
var uploadInfo = await _storageConnectorService.GenerateDirectUploadInfo(...);

// Generate download URL (client downloads directly from cloud)
var downloadInfo = await _storageConnectorService.GenerateDirectDownloadInfo(...);

Face Recognition Integration

StorageConnector includes built-in support for facial recognition:

var faceInfo = await _storageConnectorService.GetFaceInfo(
    faceListName: "user-faces",
    regionCountryIsoCode: CountryIsoCode.US,
    fileNameWithExtension: new CloudFileName("faces/user123.jpg"),
    userData: "user-metadata"
);

🏗️ Architecture

StorageConnector uses a provider pattern with a unified interface (IStorageProvider) implemented by:

  • AzureBlobStorageService - Azure Blob Storage operations
  • AmazonS3BucketService - AWS S3 operations
  • GCPStorageService - Google Cloud Storage operations

The main StorageConnectorService orchestrates between providers based on configuration and country routing.


🤝 Contributing

We welcome contributions! Here's how you can help:

  1. 🐛 Report bugs - Open an issue
  2. 💡 Suggest features - Start a discussion
  3. 🔧 Submit PRs - Fork, create a feature branch, and submit a pull request

Development Setup

git clone https://github.com/prmeyn/StorageConnector.git
cd StorageConnector
dotnet restore
dotnet build

📋 Requirements

  • .NET 10.0 or later
  • Cloud provider accounts (Azure, AWS, and/or GCP)

📄 License

This project is licensed under the GNU General Public License v3.0 - see the LICENSE file for details.



🙏 Acknowledgments

Built with ❤️ using:


Happy coding! 🚀🌐📚

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows 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
10.0.0 156 11/26/2025
6.1.0 294 4/5/2025
6.0.3 215 2/21/2025
6.0.2 123 2/20/2025
6.0.1 119 2/19/2025
6.0.0 136 2/14/2025
5.0.4 131 2/12/2025
5.0.3 124 2/12/2025
5.0.2 113 2/11/2025
5.0.1 129 2/11/2025
5.0.0 128 2/10/2025
4.0.3 117 2/9/2025
4.0.2 127 2/9/2025
4.0.1 112 2/9/2025
4.0.0 120 2/9/2025
3.0.0 179 2/2/2025
2.0.0 143 1/29/2025
1.2.0 167 1/29/2025
1.1.0 165 1/26/2025
1.0.0 140 1/26/2025

Initial release with support for Azure Blob Storage, AWS S3, and Google Cloud Storage.