Freigeben über


InstanceStoreProvider.UniqueProviderIdentifier-Methode

Gibt eine eindeutige Anbieter-ID zurück, die zur Bestimmung verwendet wird, ob verschiedene Anbieterobjekte zum gleichen zugrundeliegenden Informationsspeicher aufgelöst werden.

Namespace: Microsoft.ApplicationServer.StoreProvider
Assembly: Microsoft.ApplicationServer.StoreProvider (in microsoft.applicationserver.storeprovider.dll)

Verwendung

Syntax

'Declaration
Public MustOverride Function UniqueProviderIdentifier As String
public abstract string UniqueProviderIdentifier ()
public:
virtual String^ UniqueProviderIdentifier () abstract
public abstract String UniqueProviderIdentifier ()
public abstract function UniqueProviderIdentifier () : String

Rückgabewert

Eine eindeutige Anbieter-ID als Zeichenfolge.

Hinweise

Dies ist der Beispielcode:

        string UniqueStoreIdentifier { get; set; }

        public override string UniqueProviderIdentifier()
        {   
            this.UniqueStoreIdentifier = GetUniqueStoreIdentifier(this.ConnectionString); 
            return this.UniqueStoreIdentifier;
        }

        private string GetUniqueStoreIdentifier(string connectionString)
        {
            using (SqlConnection connection = new SqlConnection(connectionString))
            {
                using (SqlCommand command = new SqlCommand())
                {
                    command.CommandType = CommandType.Text;
                    command.CommandText = "SELECT TOP (1) [StoreIdentifier] FROM [Microsoft.ApplicationServer.DurableInstancing].[StoreVersion]";
                    command.Connection = connection;

                    command.Connection.Open();

                    Guid identifier = (Guid)command.ExecuteScalar();
                    return identifier.ToString();
                }
            }
        }

Threadsicherheit

Alle öffentlichen statischen (Freigegebenen in Visual Basic) Member dieses Typs sind threadsicher. Instanzmember sind nicht garantiert threadsicher.

Plattformen

Entwicklungsplattformen

Visual Studio 2010 und höher, .NET Framework 4

Zielplattformen

Windows 7; Windows Server 2008 R2; Windows Server 2008 Service Pack 2; Windows Vista Service Pack 2

Change History

Siehe auch

Verweis

InstanceStoreProvider-Klasse
InstanceStoreProvider-Member
Microsoft.ApplicationServer.StoreProvider-Namespace