本文整理汇总了C#中AzureService.ChangeServiceName方法的典型用法代码示例。如果您正苦于以下问题:C# AzureService.ChangeServiceName方法的具体用法?C# AzureService.ChangeServiceName怎么用?C# AzureService.ChangeServiceName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AzureService
的用法示例。
在下文中一共展示了AzureService.ChangeServiceName方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: InitializeSettingsAndCreatePackage
/// <summary>
/// Initialize our model of the AzureService located at the given
/// path along with its DeploymentSettings and SubscriptionId.
/// </summary>
/// <param name="rootPath">Root path of the Azure service.</param>
/// <param name="manifest">External runtime manifest to use, mainly for testing purposes</param>
internal bool InitializeSettingsAndCreatePackage(string rootPath, string manifest = null)
{
Debug.Assert(!string.IsNullOrEmpty(rootPath), "rootPath cannot be null or empty.");
Debug.Assert(Directory.Exists(rootPath), "rootPath does not exist.");
_azureService = new AzureService(rootPath, null);
// If user provided a service name, change current service name to use it.
//
if (!string.IsNullOrEmpty(ServiceName))
{
_azureService.ChangeServiceName(ServiceName, _azureService.Paths);
}
ServiceSettings defaultSettings = ServiceSettings.LoadDefault(
_azureService.Paths.Settings,
Slot,
Location,
AffinityGroup,
Subscription,
StorageAccountName,
ServiceName,
_azureService.ServiceName,
out _hostedServiceName);
if (!string.IsNullOrEmpty(defaultSettings.Subscription))
{
var globalComponents = GlobalComponents.Load(GlobalPathInfo.GlobalSettingsDirectory);
CurrentSubscription = globalComponents.Subscriptions.Values.First(
subscription => subscription.SubscriptionName == defaultSettings.Subscription);
}
else
{
defaultSettings.Subscription = CurrentSubscription.SubscriptionName;
}
WriteVerboseWithTimestamp(String.Format(Resources.RuntimeDeploymentStart,
_hostedServiceName));
if (PrepareRuntimeDeploymentInfo(_azureService, defaultSettings, manifest))
{
WriteVerboseWithTimestamp(String.Format(Resources.PublishPreparingDeploymentMessage,
_hostedServiceName, CurrentSubscription.SubscriptionId));
// Caching worker roles require update to their service configuration settings with
// the storage service credentials. Before creating the package verify that the storage
// service exists and fetch its credentials.
if (!StorageAccountExists(defaultSettings.StorageAccountName))
{
CreateStorageAccount(
defaultSettings.StorageAccountName,
_hostedServiceName,
defaultSettings.Location,
defaultSettings.AffinityGroup);
}
// Initiate call to all publish listeners.
this._listeners.ForEach<IPublishListener>(l => l.OnPublish(Channel, _azureService, defaultSettings, CurrentSubscription.SubscriptionId));
CreatePackage();
_deploymentSettings = new DeploymentSettings(
defaultSettings,
_azureService.Paths.CloudPackage,
_azureService.Paths.CloudConfiguration,
_hostedServiceName,
string.Format(Resources.ServiceDeploymentName, defaultSettings.Slot));
return true;
}
return false;
}
示例2: ChangeServiceNameTest
public void ChangeServiceNameTest()
{
string newName = "NodeAppService";
using (FileSystemHelper files = new FileSystemHelper(this))
{
AzureService service = new AzureService(files.RootPath, serviceName, null);
service.ChangeServiceName(newName, service.Paths);
Assert.AreEqual<string>(newName, service.Components.CloudConfig.serviceName);
Assert.AreEqual<string>(newName, service.Components.LocalConfig.serviceName);
Assert.AreEqual<string>(newName, service.Components.Definition.name);
}
}
示例3: InitializeSettingsAndCreatePackage
/// <summary>
/// Initialize our model of the AzureService located at the given
/// path along with its DeploymentSettings and SubscriptionId.
/// </summary>
/// <param name="rootPath">Root path of the Azure service.</param>
internal void InitializeSettingsAndCreatePackage(string rootPath)
{
Debug.Assert(!string.IsNullOrEmpty(rootPath), "rootPath cannot be null or empty.");
Debug.Assert(Directory.Exists(rootPath), "rootPath does not exist.");
_azureService = new AzureService(rootPath, null);
// If user provided a service name, change current service name to use it.
//
if (!string.IsNullOrEmpty(ServiceName))
{
_azureService.ChangeServiceName(ServiceName, _azureService.Paths);
}
ServiceSettings defaultSettings = ServiceSettings.LoadDefault(
_azureService.Paths.Settings,
Slot,
Location,
Subscription,
StorageAccountName,
ServiceName,
_azureService.ServiceName,
out _hostedServiceName);
if (!string.IsNullOrEmpty(defaultSettings.Subscription))
{
var globalComponents = GlobalComponents.Load(GlobalPathInfo.GlobalSettingsDirectory);
CurrentSubscription = globalComponents.Subscriptions.Values.First(
subscription => subscription.SubscriptionName == defaultSettings.Subscription);
}
else
{
defaultSettings.Subscription = CurrentSubscription.SubscriptionName;
}
SafeWriteObjectWithTimestamp(String.Format(Resources.PublishPreparingDeploymentMessage,
_hostedServiceName, CurrentSubscription.SubscriptionId));
CreatePackage();
_deploymentSettings = new DeploymentSettings(
defaultSettings,
_azureService.Paths.CloudPackage,
_azureService.Paths.CloudConfiguration,
_hostedServiceName,
string.Format(Resources.ServiceDeploymentName, defaultSettings.Slot));
}