次の方法で共有


RoleEnvironmentConfigurationSettingChange.ConfigurationSettingName Property

 

Gets the name of the configuration setting that has been changed.

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

Syntax

public string ConfigurationSettingName { get; internal set; }
public:
property String^ ConfigurationSettingName {
    String^ get();
    internal: void set(String^ value);
}
member ConfigurationSettingName : string with get, internal set
Public Property ConfigurationSettingName As String
    Get
    Friend Set
End Property

Property Value

Type: System.String

Type: System.String

A String that contains the name of the configuration setting.

Remarks

If the setting name is coming from the RoleEnvironmentChangedEventArgs object, the value is the new value. If the setting name is coming from the RoleEnvironmentChangingEventArgs object, the value is the old value because the change has not been applied yet. The value of the setting can be obtained with the GetConfigurationSettingValue method.

The following code example shows how to write out the setting names and values that have been changed:

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 settingName = settingChange.ConfigurationSettingName;
      var settingValue = 
         RoleEnvironment.GetConfigurationSettingValue(settingName);
      Trace.WriteLine(settingName + ": " + settingValue, "Information");
   }
}

See Also

RoleEnvironmentConfigurationSettingChange Class
Microsoft.WindowsAzure.ServiceRuntime Namespace

Return to top