PersonalizationProvider Class

Implements the basic functionality for a personalization provider.

Namespace:  System.Web.UI.WebControls.WebParts
Assembly:  System.Web (in System.Web.dll)

[<AbstractClass>]
type PersonalizationProvider =  
    class 
        inherit ProviderBase 
    end

The PersonalizationProvider type exposes the following members.

  NameDescription
Protected methodPersonalizationProviderInitializes a new instance of the PersonalizationProvider class.
Top

  NameDescription
Public propertyApplicationNameWhen overridden in a derived class, gets or sets the name of the application configured for the provider.
Public propertyDescriptionGets a brief, friendly description suitable for display in administrative tools or other user interfaces (UIs). (Inherited from ProviderBase.)
Public propertyNameGets the friendly name used to refer to the provider during configuration. (Inherited from ProviderBase.)
Top

  NameDescription
Protected methodCreateSupportedUserCapabilitiesReturns a list of WebPartUserCapability objects that represent the set of known capabilities used by the Web Parts control set.
Public methodDetermineInitialScopeDetermines whether the initial personalization scope should be Shared or User scope.
Public methodDetermineUserCapabilitiesReturns a dictionary containing WebPartUserCapability instances that represent the personalization-related capabilities of the currently executing user account.
Public methodEquals(Object)Determines whether the specified object is equal to the current object. (Inherited from Object.)
Protected methodFinalizeAllows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.)
Public methodFindStateWhen overridden in a derived class, returns a collection containing zero or more PersonalizationStateInfo-derived objects based on scope and specific query parameters.
Public methodGetCountOfStateWhen overridden in a derived class, returns the number of rows in the underlying data store that exist within the specified scope.
Public methodGetHashCodeServes as the default hash function. (Inherited from Object.)
Public methodGetTypeGets the Type of the current instance. (Inherited from Object.)
Public methodInitializeInitializes the provider. (Inherited from ProviderBase.)
Protected methodLoadPersonalizationBlobsWhen overridden in a derived class, loads raw personalization data from the underlying data store.
Public methodLoadPersonalizationStateLoads the raw data from the underlying data store and converts that data into a PersonalizationState object.
Protected methodMemberwiseCloneCreates a shallow copy of the current Object. (Inherited from Object.)
Protected methodResetPersonalizationBlobWhen overridden in a derived class, deletes raw personalization data from the underlying data store.
Public methodResetPersonalizationStateResets personalization data to the underlying data store.
Public methodResetStateWhen overridden in a derived class, deletes personalization state from the underlying data store based on the specified parameters.
Public methodResetUserStateWhen overridden in a derived class, deletes Web Parts personalization data from the underlying data store based on the specified parameters.
Protected methodSavePersonalizationBlobWhen overridden in a derived class, saves raw personalization data to the underlying data store.
Public methodSavePersonalizationStateSaves personalization data to a data store.
Public methodToStringReturns a string that represents the current object. (Inherited from Object.)
Top

This is the abstract base class that defines the required functionality of a personalization provider. 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. 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.

Notes to Inheritors

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. 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.

Implementations of PersonalizationProvider are tightly coupled to implementations of PersonalizationState because some personalization provider methods return instances of PersonalizationState-derived classes. 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 - This method needs to be able to count the number of rows of personalization data in the database for the supplied query parameters.

  • LoadPersonalizationBlobs - 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. 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 - Given the path and user name, this method deletes the corresponding row in the database. 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 - Given the path and user name, this method saves the supplied BLOB to the database. 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. In the case of LoadPersonalizationBlobs, 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 a null reference (Nothing in Visual Basic).

All other abstract methods are intended for use only in administrative applications and are not used by the Web Parts infrastructure at run time. For an example of an implementation of a personalization provider, see the SqlPersonalizationProvider class.

.NET Framework

Supported in: 4.5, 4, 3.5, 3.0, 2.0

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft