RoleEnvironmentChangingEventArgs.Changes Property


Gets a collection of the configuration changes that are ready to be applied to the role instance.

Namespace:   Microsoft.WindowsAzure.ServiceRuntime
Assembly:  Microsoft.WindowsAzure.ServiceRuntime (in Microsoft.WindowsAzure.ServiceRuntime.dll)

Public Property Changes As ReadOnlyCollection(Of RoleEnvironmentChange)
	Friend Set
End Property

Property Value

Type: System.Collections.ObjectModel.ReadOnlyCollection(Of RoleEnvironmentChange)

Type: System.Collections.ObjectModel.ReadOnlyCollection

A ReadOnlyCollection(Of T) of RoleEnvironmentChange objects.

You can use the values in the Changes property to determine whether the role instance must be recycled. The changes can be of the RoleEnvironmentTopologyChange type or the RoleEnvironmentConfigurationSettingChange type.

The following code example shows how to restart a role instance only when configuration setting values change:

public override bool OnStart()
   RoleEnvironment.Changing += RoleEnvironmentChanging;

   return base.OnStart();

private void RoleEnvironmentChanging(object sender, RoleEnvironmentChangingEventArgs e) 
   // Implements the changes after restarting the role instance
   if ((e.Changes.Any(change is RoleEnvironmentConfigurationSettingChange))) 
      e.Cancel = true;
Return to top