예제 #1
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="storageAccountName"></param>
        private void InitializeAzureStorage(AzureStorageOptions options)
        {
            Debug.Assert(null != options);

            // TODO: put in the logic to appropriately load configuration
            bool useRoleEnvironment = false;
            string storageConnectionStringValue = null;

            if (useRoleEnvironment)
            {
                storageConnectionStringValue = RoleEnvironment.GetConfigurationSettingValue(options.StorageAccountName);
            }
            else
            {
                storageConnectionStringValue = ConfigurationManager.ConnectionStrings[options.StorageAccountName].ConnectionString;
            }

            Debug.Assert(null != storageConnectionStringValue);

            Account = CloudStorageAccount.Parse(storageConnectionStringValue);

            // This will not work unless run in the DevFabric or in Azure
            // Trace.WriteLine("Azure account credentials:" + Account.Credentials.ToString(), "Information");

            TableClient = Account.CreateCloudTableClient();
            TableClient.RetryPolicy = RetryPolicies.Retry(4, TimeSpan.Zero);
            TableServiceContext = TableClient.GetDataServiceContext();

            BlobClient = Account.CreateCloudBlobClient();
            BlobClient.RetryPolicy = RetryPolicies.Retry(4, TimeSpan.Zero);

            QueueClient = Account.CreateCloudQueueClient();
            QueueClient.RetryPolicy = RetryPolicies.Retry(4, TimeSpan.Zero);

        }
예제 #2
0
        public AzureOptions(AzureStorageOptions storageOptions, AzureAppFabricOptions appFabricOptions, AzureDiagnosticsOptions diagnosticsOptions)
        {
            Debug.Assert(null != storageOptions);
            Debug.Assert(null != appFabricOptions);
            Debug.Assert(null != diagnosticsOptions);

            StorageOptions = storageOptions;
            AppFabricOptions = appFabricOptions;
            DiagnosticsOptions = diagnosticsOptions;
        }