當前位置: 首頁>>代碼示例>>C#>>正文


C# CloudStorageAccount.ToString方法代碼示例

本文整理匯總了C#中Microsoft.WindowsAzure.Storage.CloudStorageAccount.ToString方法的典型用法代碼示例。如果您正苦於以下問題:C# CloudStorageAccount.ToString方法的具體用法?C# CloudStorageAccount.ToString怎麽用?C# CloudStorageAccount.ToString使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Microsoft.WindowsAzure.Storage.CloudStorageAccount的用法示例。


在下文中一共展示了CloudStorageAccount.ToString方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: MyClassInitialize

        public static void MyClassInitialize(TestContext testContext)
        {
            Trace.WriteLine("ClassInit");
            Test.FullClassName = testContext.FullyQualifiedTestClassName;

            StorageAccount = TestBase.GetCloudStorageAccountFromConfig();

            //init the blob helper for blob related operations
            BlobHelper = new CloudBlobHelper(StorageAccount);

            // import module
            string moduleFilePath = Test.Data.Get("ModuleFilePath");
            if (moduleFilePath.Length > 0)
                PowerShellAgent.ImportModule(moduleFilePath);

            // $context = New-AzureStorageContext -ConnectionString ...
            PowerShellAgent.SetStorageContext(StorageAccount.ToString(true));

            BlockFilePath = Path.Combine(Test.Data.Get("TempDir"), FileUtil.GetSpecialFileName());
            PageFilePath = Path.Combine(Test.Data.Get("TempDir"), FileUtil.GetSpecialFileName());
            FileUtil.CreateDirIfNotExits(Path.GetDirectoryName(BlockFilePath));
            FileUtil.CreateDirIfNotExits(Path.GetDirectoryName(PageFilePath));

            // Generate block file and page file which are used for uploading
            Helper.GenerateMediumFile(BlockFilePath, 1);
            Helper.GenerateMediumFile(PageFilePath, 1);
        }
開發者ID:takekazuomi,項目名稱:azure-sdk-tools,代碼行數:27,代碼來源:CLIBlobFunc.cs

示例2: MyClassInitialize

        public static void MyClassInitialize(TestContext testContext)
        {
            Trace.WriteLine("ClassInit");
            Test.FullClassName = testContext.FullyQualifiedTestClassName;

            _StorageAccount = TestBase.GetCloudStorageAccountFromConfig();

            // import module
            string moduleFilePath = Test.Data.Get("ModuleFilePath");
            if (moduleFilePath.Length > 0)
                PowerShellAgent.ImportModule(moduleFilePath);

            // $context = New-AzureStorageContext -ConnectionString ...
            PowerShellAgent.SetStorageContext(_StorageAccount.ToString(true));
        }
開發者ID:takekazuomi,項目名稱:azure-sdk-tools,代碼行數:15,代碼來源:CLITableFunc.cs

示例3: GetStorageServiceConnectionString

        /// <summary>
        /// Gets connection string of the given storage service name.
        /// </summary>
        /// <param name="name">The storage service name</param>
        /// <returns>The connection string</returns>
        public string GetStorageServiceConnectionString(string name)
        {
            StorageService storageService = GetStorageService(name);

            Debug.Assert(storageService.StorageServiceKeys != null);
            Debug.Assert(storageService.ServiceName != null);

            StorageCredentials credentials = new StorageCredentials(
                storageService.ServiceName,
                storageService.StorageServiceKeys.Primary);

            CloudStorageAccount cloudStorageAccount = new CloudStorageAccount(
                credentials,
                General.CreateHttpsEndpoint(storageService.StorageServiceProperties.Endpoints[0]),
                General.CreateHttpsEndpoint(storageService.StorageServiceProperties.Endpoints[1]),
                General.CreateHttpsEndpoint(storageService.StorageServiceProperties.Endpoints[2])
                );

            return cloudStorageAccount.ToString(true);
        }
開發者ID:xmbms,項目名稱:azure-sdk-tools,代碼行數:25,代碼來源:CloudServiceClient.cs

示例4: TestClassInitialize

        public static void TestClassInitialize(TestContext testContext)
        {
            Test.Info(string.Format("{0} Class Initialize", testContext.FullyQualifiedTestClassName));
            Test.FullClassName = testContext.FullyQualifiedTestClassName;

            StorageAccount = GetCloudStorageAccountFromConfig();

            //init the blob helper for blob related operations
            blobUtil = new CloudBlobUtil(StorageAccount);
            queueUtil = new CloudQueueUtil(StorageAccount);
            tableUtil = new CloudTableUtil(StorageAccount);

            // import module
            string moduleFilePath = Test.Data.Get("ModuleFilePath");
            PowerShellAgent.ImportModule(moduleFilePath);

            //set the default storage context
            PowerShellAgent.SetStorageContext(StorageAccount.ToString(true));

            random = new Random();
            ContainerInitCount = blobUtil.GetExistingContainerCount();
            QueueInitCount = queueUtil.GetExistingQueueCount();
            TableInitCount = tableUtil.GetExistingTableCount();
        }
開發者ID:Viachaslau,項目名稱:azure-sdk-tools,代碼行數:24,代碼來源:TestBase.cs

示例5: SetApplicationDiagnosticsSettings

        private void SetApplicationDiagnosticsSettings(
            string name,
            WebsiteDiagnosticOutput output,
            bool setFlag,
            Dictionary<DiagnosticProperties, object> properties = null)
        {
            Site website = GetWebsite(name);

            using (HttpClient client = CreateDeploymentHttpClient(website.Name))
            {
                DiagnosticsSettings diagnosticsSettings = GetApplicationDiagnosticsSettings(website.Name);
                switch (output)
                {
                    case WebsiteDiagnosticOutput.FileSystem:
                        diagnosticsSettings.AzureDriveTraceEnabled = setFlag;
                        diagnosticsSettings.AzureDriveTraceLevel = setFlag ?
                        (LogEntryType)properties[DiagnosticProperties.LogLevel] :
                        diagnosticsSettings.AzureDriveTraceLevel;
                        break;

                    case WebsiteDiagnosticOutput.StorageTable:
                        diagnosticsSettings.AzureTableTraceEnabled = setFlag;
                        if (setFlag)
                        {
                            const string storageTableName = "CLOUD_STORAGE_ACCOUNT";
                            string storageAccountName = (string)properties[DiagnosticProperties.StorageAccountName];

                            StorageService storageService = ServiceManagementChannel.GetStorageKeys(
                                subscriptionId,
                                storageAccountName);
                            StorageCredentials credentials = new StorageCredentials(
                                storageAccountName,
                                storageService.StorageServiceKeys.Primary);
                            CloudStorageAccount cloudStorageAccount = new CloudStorageAccount(credentials, false);
                            string connectionString = cloudStorageAccount.ToString(true);
                            AddAppSetting(website.Name, storageTableName, connectionString);
                            diagnosticsSettings.AzureTableTraceLevel = setFlag ?
                                (LogEntryType)properties[DiagnosticProperties.LogLevel] :
                                diagnosticsSettings.AzureTableTraceLevel;
                        }
                        break;

                    default:
                        throw new ArgumentException();
                }

                JObject json = new JObject();
                json[UriElements.AzureDriveTraceEnabled] = diagnosticsSettings.AzureDriveTraceEnabled;
                json[UriElements.AzureDriveTraceLevel] = JToken.FromObject(diagnosticsSettings.AzureDriveTraceLevel);
                json[UriElements.AzureTableTraceEnabled] = diagnosticsSettings.AzureTableTraceEnabled;
                json[UriElements.AzureTableTraceLevel] = JToken.FromObject(diagnosticsSettings.AzureTableTraceLevel);
                client.PostAsJsonAsync(UriElements.DiagnosticsSettings, json, Logger);
            }
        }
開發者ID:Viachaslau,項目名稱:azure-sdk-tools,代碼行數:54,代碼來源:WebsitesClient.cs


注:本文中的Microsoft.WindowsAzure.Storage.CloudStorageAccount.ToString方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。