PersonalizationProvider 类

定义

实现个性化设置提供程序的基本功能。Implements the basic functionality for a personalization provider.

public ref class PersonalizationProvider abstract : System::Configuration::Provider::ProviderBase
public abstract class PersonalizationProvider : System.Configuration.Provider.ProviderBase
type PersonalizationProvider = class
    inherit ProviderBase
Public MustInherit Class PersonalizationProvider
Inherits ProviderBase
继承
PersonalizationProvider
派生

注解

这是定义个性化设置提供程序所需功能的抽象基类。This is the abstract base class that defines the required functionality of a personalization provider. 个性化设置提供程序代表WebPartPersonalization实例加载和存储个性化数据。A personalization provider both loads and stores personalization data on behalf of a WebPartPersonalization instance.

基类定义了许多方法的标准行为;只有那些专门处理基础数据存储区的方法才会标记为抽象。The base class defines standard behavior for a number of methods; only those methods that specifically deal with the underlying data store are marked abstract. 这允许开发人员编写自定义提供程序以与特定数据存储区交互,而无需重新实现WebPartPersonalization类使用的标准功能。This allows a developer to write a custom provider to interact with a specific data store, without needing to re-implement standard functionality used by the WebPartPersonalization class.

继承者说明

你可以从PersonalizationProvider派生并仅提供此类中定义的抽象方法的实现。You can derive from PersonalizationProvider and provide implementations for only the abstract methods defined in this class. 抽象方法专门介绍了如何在物理数据存储区中保存数据并将数据加载到数据存储管理。The abstract methods deal specifically with saving and loading data to a physical data store, and with data store administration. 自定义提供程序必须能够以区分Shared数据与User数据的方式来操作个性化设置信息。A custom provider must be capable of manipulating personalization information in a manner that distinguishes Shared data from User data. 此外,提供程序还必须按页以及应用程序划分个性化数据。Furthermore, a provider must segment personalization data by page as well as by application.

PersonalizationProvider实现与的PersonalizationState实现紧密耦合,因为某些个性化设置提供程序方法返回PersonalizationState派生类的实例。Implementations of PersonalizationProvider are tightly coupled to implementations of PersonalizationState because some personalization provider methods return instances of PersonalizationState-derived classes. 为了简化自定义提供程序的开发PersonalizationProvider ,基类包含个性化设置逻辑的默认实现和直接WebPartPersonalization由类使用的序列化/反序列化逻辑。To ease development of custom providers, the PersonalizationProvider base class includes a default implementation of the personalization logic and serialization/deserialization logic that is used directly by the WebPartPersonalization class. 因此,创作仅用于处理不同数据存储的自定义提供程序只需要实现以下抽象方法:As a result, authoring a custom provider solely for the purpose of working with a different data store only requires implementation of the following abstract methods:

  • GetCountOfState(PersonalizationScope, PersonalizationStateQuery) - This method needs to be able to count the number of rows of personalization data in the database for the supplied query parameters.

  • LoadPersonalizationBlobs(WebPartManager, String, String, Byte[], Byte[])-给定路径和用户名,此方法从数据库加载两个二进制大型对象(Blob):一个 BLOB 用于共享数据,一个用于用户数据。
  • LoadPersonalizationBlobs(WebPartManager, String, String, Byte[], Byte[]) - Given the path and user name, this method loads two binary large objects (BLOBs) from the database: one BLOB for shared data and one for user data.
  • 如果提供了用户名和路径,则不需要WebPartManager控件访问可提供用户名/路径信息的页面信息。If you supply the user name and path, then you do not need the WebPartManager control to access the page information that can provide the user name/path information.
  • ResetPersonalizationBlob(WebPartManager, String, String)-给定路径和用户名,此方法会删除数据库中的相应行。
  • ResetPersonalizationBlob(WebPartManager, String, String) - Given the path and user name, this method deletes the corresponding row in the database.
  • 如果提供了用户名和路径,则不需要WebPartManager控件访问可提供用户名/路径信息的页面信息。If you supply the user name and path, then you do not need the WebPartManager control to access the page information that can provide the user name/path information.
  • SavePersonalizationBlob(WebPartManager, String, String, Byte[])-给定路径和用户名,此方法会将提供的 BLOB 保存到数据库。
  • SavePersonalizationBlob(WebPartManager, String, String, Byte[]) - Given the path and user name, this method saves the supplied BLOB to the database.
  • 如果提供了用户名和路径,则不需要WebPartManager控件访问可提供用户名/路径信息的页面信息。If you supply the user name and path, then you do not need the WebPartManager control to access the page information that can provide the user name/path information.

    在所有这些方法中,如果只提供了路径,则指示对该页的共享个性化数据进行操作。In all of these methods, if only a path is supplied, that indicates the shared personalization data for the page is being operated upon. 如果路径和用户名都传递到方法,则应对该页的用户个性化设置数据进行操作。If both a path and a username are passed to a method, then the user personalization data for the page should be acted upon. 对于LoadPersonalizationBlobs(WebPartManager, String, String, Byte[], Byte[]),应始终加载指定路径的共享数据,并且如果用户名不null为,还应加载该路径的用户个性化数据。In the case of LoadPersonalizationBlobs(WebPartManager, String, String, Byte[], Byte[]), the shared data for the specified path should always be loaded, and optionally the user personalization data for the path should also be loaded if the username is not null.

    所有其他抽象方法仅适用于管理应用程序,在运行时,Web 部件基础结构不使用这些方法。All other abstract methods are intended for use only in administrative applications and are not used by the Web Parts infrastructure at run time. 有关个性化设置提供程序的实现的示例,请参见SqlPersonalizationProvider类。For an example of an implementation of a personalization provider, see the SqlPersonalizationProvider class.

    构造函数

    PersonalizationProvider()

    初始化 PersonalizationProvider 类的新实例。Initializes a new instance of the PersonalizationProvider class.

    属性

    ApplicationName

    在派生类中重写时,获取或设置为提供程序配置的应用程序的名称。When overridden in a derived class, gets or sets the name of the application configured for the provider.

    Description

    获取一条简短的易懂描述,它适合在管理工具或其他用户界面 (UI) 中显示。Gets a brief, friendly description suitable for display in administrative tools or other user interfaces (UIs).

    (继承自 ProviderBase)
    Name

    获得一个友好名称,用于在配置过程中引用提供程序。Gets the friendly name used to refer to the provider during configuration.

    (继承自 ProviderBase)

    方法

    CreateSupportedUserCapabilities()

    返回 WebPartUserCapability 对象的列表,这些对象表示 Web 部件控件集所使用的已知功能集。Returns a list of WebPartUserCapability objects that represent the set of known capabilities used by the Web Parts control set.

    DetermineInitialScope(WebPartManager, PersonalizationState)

    确定初始个性化设置范围应为 Shared 还是 User 范围。Determines whether the initial personalization scope should be Shared or User scope.

    DetermineUserCapabilities(WebPartManager)

    返回一个包含 WebPartUserCapability 实例的字典,这些实例表示当前正在执行的用户帐户的与个性化设置相关的功能。Returns a dictionary containing WebPartUserCapability instances that represent the personalization-related capabilities of the currently executing user account.

    Equals(Object)

    确定指定的对象是否等于当前对象。Determines whether the specified object is equal to the current object.

    (继承自 Object)
    FindState(PersonalizationScope, PersonalizationStateQuery, Int32, Int32, Int32)

    在派生类中重写时,将根据范围和特定的查询参数返回一个集合,其中包含零个或零个以上 PersonalizationStateInfo 派生对象。When overridden in a derived class, returns a collection containing zero or more PersonalizationStateInfo-derived objects based on scope and specific query parameters.

    GetCountOfState(PersonalizationScope, PersonalizationStateQuery)

    在派生类中重写时,返回基础数据存储区中存在于指定范围内的行数。When overridden in a derived class, returns the number of rows in the underlying data store that exist within the specified scope.

    GetHashCode()

    作为默认哈希函数。Serves as the default hash function.

    (继承自 Object)
    GetType()

    获取当前实例的 TypeGets the Type of the current instance.

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

    初始化配置生成器。Initializes the configuration builder.

    (继承自 ProviderBase)
    LoadPersonalizationBlobs(WebPartManager, String, String, Byte[], Byte[])

    在派生类中重写时,从基础数据存储区加载原始个性化设置数据。When overridden in a derived class, loads raw personalization data from the underlying data store.

    LoadPersonalizationState(WebPartManager, Boolean)

    从基础数据存储区加载原始数据,并将该数据转换为 PersonalizationState 对象。Loads the raw data from the underlying data store and converts that data into a PersonalizationState object.

    MemberwiseClone()

    创建当前 Object 的浅表副本。Creates a shallow copy of the current Object.

    (继承自 Object)
    ResetPersonalizationBlob(WebPartManager, String, String)

    在派生类中重写时,从基础数据存储区删除原始个性化设置数据。When overridden in a derived class, deletes raw personalization data from the underlying data store.

    ResetPersonalizationState(WebPartManager)

    将个性化设置数据重置到基础数据存储区。Resets personalization data to the underlying data store.

    ResetState(PersonalizationScope, String[], String[])

    在派生类中重写时,根据指定的参数从基础数据存储区删除个性化设置状态。When overridden in a derived class, deletes personalization state from the underlying data store based on the specified parameters.

    ResetUserState(String, DateTime)

    在派生类中重写时,根据指定的参数从基础数据存储区删除 Web 部件个性化设置数据。When overridden in a derived class, deletes Web Parts personalization data from the underlying data store based on the specified parameters.

    SavePersonalizationBlob(WebPartManager, String, String, Byte[])

    在派生类中重写时,将原始个性化设置数据保存到基础数据存储区中。When overridden in a derived class, saves raw personalization data to the underlying data store.

    SavePersonalizationState(PersonalizationState)

    将个性化设置数据保存到数据存储区中。Saves personalization data to a data store.

    ToString()

    返回表示当前对象的字符串。Returns a string that represents the current object.

    (继承自 Object)

    适用于

    另请参阅