本文整理汇总了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);
}
示例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));
}
示例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);
}
示例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();
}
示例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);
}
}