Condividi tramite


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)

Syntax

public ReadOnlyCollection<RoleEnvironmentChange> Changes { get; internal set; }
public:
property ReadOnlyCollection<RoleEnvironmentChange^>^ Changes {
    ReadOnlyCollection<RoleEnvironmentChange^>^ get();
    internal: void set(ReadOnlyCollection<RoleEnvironmentChange^>^ value);
}
member Changes : ReadOnlyCollection<RoleEnvironmentChange> with get, internal set
Public Property Changes As ReadOnlyCollection(Of RoleEnvironmentChange)
    Get
    Friend Set
End Property

Property Value

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

Type: System.Collections.ObjectModel.ReadOnlyCollection

A ReadOnlyCollection<T> of RoleEnvironmentChange objects.

Remarks

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;
   }
}

See Also

RoleEnvironment
RoleEnvironmentChangingEventArgs Class
Microsoft.WindowsAzure.ServiceRuntime Namespace

Return to top