Skip to content

Latest commit

 

History

History
76 lines (59 loc) · 2.47 KB

Azure.md

File metadata and controls

76 lines (59 loc) · 2.47 KB

LiteX Azure Storage

LiteX.Storage.Azure is a storage library which is based on LiteX.Storage.Core and Microsoft Azure API.

This client library enables working with the Microsoft Azure Storage (Blob) service for storing binary/blob data.

Small library to abstract storing files to Microsoft Azure. Quick setup for Azure Storage and very simple wrapper for the Azure Blob Storage to handle container instantiations.

Very simple configuration in advanced ways. Purpose of this package is to bring a new level of ease to the developers who deal with Azure Blob Storage integration with their system.

Basic Usage

Install the package

Install via Nuget.

PM> Install-Package LiteX.Storage.Azure
AppSettings
{  
  //LiteX Azure Storage settings
  "AzureBlobConfig": {
    "AzureBlobStorageConnectionString": "--- REPLACE WITH YOUR AZURE CONNECTION STRING ---",
    "AzureBlobStorageContainerName": "--- REPLACE WITH YOUR AZURE CONTAINER NAME ---",
    "AzureBlobStorageEndPoint": "--- REPLACE WITH YOUR AZURE END POINT ---",
    "EnableLogging": true
  }
}
Configure Startup Class
public class Startup
{
    public void ConfigureServices(IServiceCollection services)
    {
        // 1. Use default configuration from appsettings.json's 'AzureBlobConfig'
        services.AddLiteXAzureBlobService();

        //OR
        // 2. Load configuration settings using options.
        services.AddLiteXAzureBlobService(option =>
        {
            option.AzureBlobStorageConnectionString = "";
            option.AzureBlobStorageContainerName = "";
            option.AzureBlobStorageEndPoint = "";
            option.EnableLogging = true;
        });

        //OR
        // 3. Load configuration settings on your own.
        // (e.g. appsettings, database, hardcoded)
        var azureBlobConfig = new AzureBlobConfig()
        {
            AzureBlobStorageConnectionString = "",
            AzureBlobStorageContainerName = "",
            AzureBlobStorageEndPoint = "",
            EnableLogging = true
        };
        services.AddLiteXAzureBlobService(azureBlobConfig);
        
        
        // add logging (optional)
        services.AddLiteXLogging();
    }
}

Sample Usage Example

Same for all providers.

For more helpful information about LiteX Storage, Please click here.