SqlProfileProvider.GetPropertyValues Metoda

Definicja

Pobiera informacje o właściwościach profilu i wartości z bazy danych profilów SQL Server.

public:
 override System::Configuration::SettingsPropertyValueCollection ^ GetPropertyValues(System::Configuration::SettingsContext ^ sc, System::Configuration::SettingsPropertyCollection ^ properties);
public override System.Configuration.SettingsPropertyValueCollection GetPropertyValues (System.Configuration.SettingsContext sc, System.Configuration.SettingsPropertyCollection properties);
override this.GetPropertyValues : System.Configuration.SettingsContext * System.Configuration.SettingsPropertyCollection -> System.Configuration.SettingsPropertyValueCollection
Public Overrides Function GetPropertyValues (sc As SettingsContext, properties As SettingsPropertyCollection) As SettingsPropertyValueCollection

Parametry

sc
SettingsContext

Element SettingsContext zawierający informacje o profilu użytkownika.

properties
SettingsPropertyCollection

Zawierający SettingsPropertyCollection informacje o profilu dla właściwości do pobrania.

Zwraca

Obiekt SettingsPropertyValueCollection zawierający informacje o właściwościach i wartościach profilu.

Przykłady

Poniższy przykład kodu zawiera listę właściwości i wartości profilu zidentyfikowanych w bieżącym profilu.

SqlProfileProvider p = 
  (SqlProfileProvider)Profile.Providers["SqlProvider"];

SettingsPropertyValueCollection pvalues = 
      p.GetPropertyValues(Profile.Context, ProfileBase.Properties);

foreach (SettingsPropertyValue pval in pvalues)
{
  Response.Write(pval.Name + " = " + pval.PropertyValue + "<br />");
} 
Dim p As SqlProfileProvider = _
  CType(Profile.Providers("SqlProvider"), SqlProfileProvider)

Dim pvalues As SettingsPropertyValueCollection = _
  p.GetPropertyValues(Profile.Context, ProfileBase.Properties)

For Each pval As SettingsPropertyValue In pvalues
  Response.Write(pval.Name & " = " & pval.PropertyValue.ToString() & "<br />")
Next

Uwagi

Metoda GetPropertyValues jest używana przez klasę ProfileBase do pobierania właściwości profilu dla bieżącego żądania zarządzanego przez klasę SqlProfileProvider. Wartości właściwości są zwracane ze źródła danych dla aplikacji określonej przez applicationName atrybut w pliku konfiguracji. Wartości właściwości i dodatkowe informacje o właściwości są zwracane jako kolekcja SettingsPropertyValue obiektów.

Dotyczy

Zobacz też