ProfileProvider 类

定义

定义 ASP.NET 实现以使用自定义配置文件提供程序提供配置文件服务的协定。

public ref class ProfileProvider abstract : System::Configuration::SettingsProvider
public abstract class ProfileProvider : System.Configuration.SettingsProvider
type ProfileProvider = class
    inherit SettingsProvider
Public MustInherit Class ProfileProvider
Inherits SettingsProvider
继承
派生

示例

有关实现的示例 ProfileProvider ,请参阅 如何:生成和运行配置文件提供程序示例

注解

ASP.NET 配置文件提供用户特定属性的持久存储和检索。 配置文件属性值和信息以实现确定的方式存储在数据源中 ProfileProvider 。 可以使用.NET框架中包含的配置文件提供程序(由派生自 ProfileProvider 抽象类的类表示),也可以通过创建派生自 ProfileProvider 的新类来实现自己的提供程序。

创建自定义配置文件提供程序有两个主要原因。

  • 你需要将配置文件信息存储在.NET框架中包含的配置文件提供程序不支持的数据源中,例如 FoxPro 数据库、Oracle 数据库或其他数据存储。

  • 需要使用与随 .NET Framework 一起提供的提供程序使用的数据库架构不同的数据库架构来管理配置文件信息。 一个常见的示例是公司网络或网站的SQL Server数据库中已存在的用户数据。

ProfileProvider抽象类继承自SettingsProvider抽象类,该抽象类继承自ProviderBase抽象类。 实现ProfileProvider的类还必须实现所需的类和SettingsProvider抽象类的成员ProviderBase。 有关实现配置文件提供程序的详细信息,请参阅 “实现配置文件提供程序”。

构造函数

名称 说明
ProfileProvider()

初始化 ProfileProvider 类的新实例。

属性

名称 说明
ApplicationName

获取或设置当前正在运行的应用程序的名称。

(继承自 SettingsProvider)
Description

获取适合在管理工具或其他用户界面(UI)中显示的简短友好说明。

(继承自 ProviderBase)
Name

获取用于在配置期间引用提供程序的友好名称。

(继承自 ProviderBase)

方法

名称 说明
DeleteInactiveProfiles(ProfileAuthenticationOption, DateTime)

在派生类中重写时,删除在指定日期之前发生最后一个活动日期的配置文件的所有用户配置文件数据。

DeleteProfiles(ProfileInfoCollection)

在派生类中重写时,删除提供的配置文件列表的配置文件属性和信息。

DeleteProfiles(String[])

在派生类中重写时,删除与提供的用户名列表匹配的配置文件的配置文件属性和信息。

Equals(Object)

确定指定的对象是否等于当前对象。

(继承自 Object)
FindInactiveProfilesByUserName(ProfileAuthenticationOption, String, DateTime, Int32, Int32, Int32)

在派生类中重写时,检索在指定日期或之前发生最后一个活动日期且用户名与指定用户名匹配的配置文件的配置文件信息。

FindProfilesByUserName(ProfileAuthenticationOption, String, Int32, Int32, Int32)

在派生类中重写时,检索用户名与指定用户名匹配的配置文件的配置文件信息。

GetAllInactiveProfiles(ProfileAuthenticationOption, DateTime, Int32, Int32, Int32)

在派生类中重写时,从数据源中检索在其中发生上次活动日期或指定日期之前的配置文件的用户配置文件数据。

GetAllProfiles(ProfileAuthenticationOption, Int32, Int32, Int32)

在派生类中重写时,检索数据源中所有配置文件的用户配置文件数据。

GetHashCode()

用作默认哈希函数。

(继承自 Object)
GetNumberOfInactiveProfiles(ProfileAuthenticationOption, DateTime)

在派生类中重写时,返回上次活动日期发生在指定日期或之前的配置文件数。

GetPropertyValues(SettingsContext, SettingsPropertyCollection)

返回指定应用程序实例和设置属性组的设置属性值的集合。

(继承自 SettingsProvider)
GetType()

获取当前实例的 Type

(继承自 Object)
Initialize(String, NameValueCollection)

初始化配置生成器。

(继承自 ProviderBase)
MemberwiseClone()

创建当前 Object的浅表副本。

(继承自 Object)
SetPropertyValues(SettingsContext, SettingsPropertyValueCollection)

设置指定属性设置组的值。

(继承自 SettingsProvider)
ToString()

返回一个表示当前对象的字符串。

(继承自 Object)

适用于

另请参阅