匯出 (0) 列印
全部展開

RoleEnvironment.Changed 事件

Occurs after a change to the service configuration is applied to the running instances of a role.

命名空間: Microsoft.WindowsAzure.ServiceRuntime
組件: Microsoft.WindowsAzure.ServiceRuntime (在 microsoft.windowsazure.serviceruntime.dll 中)

'用途
Dim handler As EventHandler(Of RoleEnvironmentChangedEventArgs)

AddHandler RoleEnvironment.Changed, handler

'宣告
Public Shared Event Changed As EventHandler(Of RoleEnvironmentChangedEventArgs)
/** @event */
public static void add_Changed (EventHandler<RoleEnvironmentChangedEventArgs> value)

/** @event */
public static void remove_Changed (EventHandler<RoleEnvironmentChangedEventArgs> value)

The Changed event and the Changing event are used together to identify and manage configuration changes to the service model. The RoleEnvironmentChangedEventArgs object provides the settings that were changed in the service configuration. You can use the Changing event to decide when the changes are applied.

The following code example shows how to write the list of configuration changes that were made to the role instance when the Changed event is raised:


public override bool OnStart()
{
   RoleEnvironment.Changed += RoleEnvironmentChanged;
  
   return base.OnStart();
}

private void RoleEnvironmentChanged(object sender, RoleEnvironmentChangedEventArgs e)
{
   // Get the list of configuration changes
   var settingChanges = e.Changes.OfType<RoleEnvironmentConfigurationSettingChange>();
      
   foreach (var settingChange in settingChanges) 
   {
      Trace.WriteLine("Setting: " + settingChange.ConfigurationSettingName, "Information");
   }
}

開發平台

Windows XP Home Edition, Windows XP Professional, Windows Server 2003、Windows Server 2008 和 Windows 2000

目標平台

社群新增項目

Microsoft 正展開一份線上問卷調查,了解您對於 MSDN 網站的看法。 如果您選擇參加,您離開 MSDN 網站時即會顯示線上問卷調查。

您是否想要參加?
顯示:
© 2014 Microsoft