SqlProfileProvider.GetPropertyValues 方法

定义

从 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

参数

sc
SettingsContext

包含用户配置文件信息的 SettingsContext

properties
SettingsPropertyCollection

一个 SettingsPropertyCollection,包含要检索的属性的配置文件信息。

返回

包含配置文件属性信息和值的 SettingsPropertyValueCollection

示例

下面的代码示例列出了在当前配置文件中标识的配置文件属性和值。

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

注解

GetPropertyValues类使用 ProfileBase 方法检索由 管理的当前请求的SqlProfileProvider配置文件属性。 属性值从配置文件中的 属性指定的 applicationName 应用程序的数据源中返回。 属性值和其他属性信息作为 对象的集合 SettingsPropertyValue 返回。

适用于

另请参阅