Changes Property
Collapse the table of content
Expand the table of content

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 ReadOnlyCollection<RoleEnvironmentChange> Changes { get; internal set; }

Property Value

Type: System.Collections.ObjectModel.ReadOnlyCollection<RoleEnvironmentChange>

Type: System.Collections.ObjectModel.ReadOnlyCollection

A ReadOnlyCollection<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
© 2015 Microsoft