Export (0) Print
Expand All

RoleEnvironmentChangedEventArgs Class

Updated: October 18, 2011

Represents the arguments for the Changed event, which occurs after a configuration change has been applied to a role instance.

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

public class RoleEnvironmentChangedEventArgs : EventArgs

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 changes that were made in the service configuration. The changes can be of the RoleEnvironmentTopologyChange type or the RoleEnvironmentConfigurationSettingChange type.

The following code example shows how to use the RoleEnvironmentChangedEventArgs object to write out the list of configuration changes that were made to the role instance:


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) 
   {
      var message = "Setting: " + settingChange.ConfigurationSettingName;
      Trace.WriteLine(message, "Information");
   }
}

System.Object
   System.EventArgs
    Microsoft.WindowsAzure.ServiceRuntime.RoleEnvironmentChangedEventArgs

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Development Platforms

Windows Vista, Windows 7, Windows Server 2008, Windows 8.1, Windows Server 2012 R2, Windows 8 and Windows Server 2012

Target Platforms

Community Additions

ADD
Show:
© 2014 Microsoft