Exemple #1
0
        public AzureStorageImageProvider(ILogger <AzureStorageImageProvider> logger, AzureStorageInfo storageInfo)
        {
            try
            {
                _logger = logger;

                _container = new BlobContainerClient(storageInfo.ConnectionString, storageInfo.ContainerName);

                logger.LogInformation($"Created {nameof(AzureStorageImageProvider)} for account {_container.AccountName} on container {_container.Name}");
            }
            catch (Exception e)
            {
                logger.LogError(e, $"Failed to create {nameof(AzureStorageImageProvider)}");
                throw;
            }
        }
        public AzureStorageImageProvider(ILogger <AzureStorageImageProvider> logger, AzureStorageInfo storageInfo)
        {
            try
            {
                _logger = logger;

                var storageAccount = CloudStorageAccount.Parse(storageInfo.ConnectionString);
                var blobClient     = storageAccount.CreateCloudBlobClient();
                _container = blobClient.GetContainerReference(storageInfo.ContainerName);

                logger.LogInformation($"Created {nameof(AzureStorageImageProvider)} for account {storageAccount.BlobEndpoint} on container {_container.Name}");
            }
            catch (Exception e)
            {
                logger.LogError(e, $"Failed to create {nameof(AzureStorageImageProvider)}");
                throw;
            }
        }