SPRZEDAŻ: 1-800-867-1389
Ta zawartość nie jest dostępna w wymaganym języku. Wersja w języku angielskim znajduje się tutaj.

CloudStorageAccount.SetConfigurationSettingPublisher Method

Updated: September 24, 2013

[This topic is part of the Microsoft Azure Storage Client Library 1.7, which has been deprecated. See Storage Client Library for the latest version.]

Sets the global configuration setting publisher for the storage account, which will be called when the account access keys are updated in the service configuration file.

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

Dim configurationSettingPublisher As Action(Of String, Func(Of String, Boolean))


public static void SetConfigurationSettingPublisher (
	Action<string,Func<string,bool>> configurationSettingPublisher



Type: System.Action

The configuration setting publisher for the storage account.

A configuration setting publisher allows adding subscribers for configuration settings. Subscribers are notified when a configuration setting changes, so that a role can determine whether or not to recycle on a given configuration change. This may be useful in the event that storage account access keys are regenerated and updated in a connection string in the service configuration file.

The following code sets a configurationSettingPublisher function by passing in an anonymous function created using nested lambda expressions. This handler function updates CloudStorageAccount instances when their corresponding configuration settings change in the service configuration file:

    ( configName, configSetter ) =>
      // Provide the configSetter with the initial value
      configSetter( RoleEnvironment.GetConfigurationSettingValue( configName ) );

      RoleEnvironment.Changed += ( sender, arg ) =>
        if( arg.Changes.OfType<RoleEnvironmentConfigurationSettingChange>( ).Any( (change) => 
            ( change.ConfigurationSettingName == configName ) ) )
          // The corresponding configuration setting has changed, so propagate the value
          if( !configSetter( RoleEnvironment.GetConfigurationSettingValue( configName ) ) )
            // In this case, the change to the storage account credentials in the
            // service configuration is significant enough that the role needs to be
            // recycled in order to use the latest settings (for example, the 
            // endpoint may have changed)

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


Czy oceniasz te materiały jako pomocne?
(Pozostało znaków: 1500)
Dziękujemy za opinię.
© 2015 Microsoft