Esempio n. 1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="AzureStorageProvider" /> class
        /// </summary>
        /// <param name="cloud">Azure config</param>
        public AzureStorageProvider(AzureConfiguration cloud)
        {
            var storageAccount = cloud.GetStorageAccountAsync().Result;

            if (storageAccount == null)
            {
                throw new CloudErrorException();
            }

            this.cloudBlobContainer = storageAccount.CreateCloudBlobClient().GetContainerReference(cloud.StorageFolder);
            this.cloudBlobContainer.CreateIfNotExists();
        }
Esempio n. 2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="AzureQueueProvider" /> class
        /// </summary>
        /// <param name="cloud">Azure cloud configuration</param>
        public AzureQueueProvider(AzureConfiguration cloud)
        {
            var storageAccount = cloud.GetStorageAccountAsync().Result;

            if (storageAccount == null)
            {
                throw new Exception("Azure Queue provider can't find storage account");
            }

            var queueClient = storageAccount.CreateCloudQueueClient();

            this.cloudQueue = queueClient.GetQueueReference(cloud.QueueName);
            this.cloudQueue.CreateIfNotExistsAsync();
        }