Editare

Partajați prin


SqlPersonalizationProvider Class

Definition

Implements a personalization provider that uses Microsoft SQL Server.

public ref class SqlPersonalizationProvider : System::Web::UI::WebControls::WebParts::PersonalizationProvider
public class SqlPersonalizationProvider : System.Web.UI.WebControls.WebParts.PersonalizationProvider
type SqlPersonalizationProvider = class
    inherit PersonalizationProvider
Public Class SqlPersonalizationProvider
Inherits PersonalizationProvider
Inheritance
SqlPersonalizationProvider

Remarks

This class defines the required functionality for a personalization provider using Microsoft SQL Server. A personalization provider both loads and stores personalization data on behalf of a WebPartPersonalization instance. This class implements the logic for reading from and writing to computers running SQL Server, and also implements all the abstract methods defined in PersonalizationProvider. For more information on personalization providers, see PersonalizationProvider.

The data design for using Web Parts personalization with SQL Server relies on the existence of two common SQL database tables, and their supporting stored procedures, that are shared for most SQL-based feature implementations. These tables and views are installed and uninstalled using the following scripts:

  • installpagepersonalization.sql - Installs the personalization tables, views, and related stored procedures.

  • uninstallpagepersonalization.sql - Uninstalls the personalization tables, views, and related stored procedures.

It is important to be aware that personalization will fail if your Web application does not run at the default trust level of Medium or higher (you can set custom trust levels in a Web.config file using the <trust level="" /> element). The PersonalizationAdministration and SqlPersonalizationProvider classes both check for a trust level of Low when they are initialized. If you configure your application to run at a trust level of Low, and you use the default SqlPersonalizationProvider provider to manage the personalization data for your application, the first time that the application tries to access personalization data, it will fail because an ASP.NET worker process running in Low trust does not have the permissions necessary to call into the various classes in the System.Data.SqlClient namespace.

Constructors

SqlPersonalizationProvider()

Initializes a new instance of the SqlPersonalizationProvider class.

Properties

ApplicationName

Gets or sets the name of the application to store and retrieve personalization information for.

Description

Gets a brief, friendly description suitable for display in administrative tools or other user interfaces (UIs).

(Inherited from ProviderBase)
Name

Gets the friendly name used to refer to the provider during configuration.

(Inherited from ProviderBase)

Methods

CreateSupportedUserCapabilities()

Returns a list of WebPartUserCapability objects that represent the set of known capabilities used by the Web Parts control set.

(Inherited from PersonalizationProvider)
DetermineInitialScope(WebPartManager, PersonalizationState)

Determines whether the initial personalization scope should be Shared or User scope.

(Inherited from PersonalizationProvider)
DetermineUserCapabilities(WebPartManager)

Returns a dictionary containing WebPartUserCapability instances that represent the personalization-related capabilities of the currently executing user account.

(Inherited from PersonalizationProvider)
Equals(Object)

Determines whether the specified object is equal to the current object.

(Inherited from Object)
FindState(PersonalizationScope, PersonalizationStateQuery, Int32, Int32, Int32)

Returns a collection containing zero or more PersonalizationStateInfo-derived objects, based on the specified scope and parameters.

GetCountOfState(PersonalizationScope, PersonalizationStateQuery)

Returns a count of the number of rows in the underlying data store that exist for the specified scope parameter.

GetHashCode()

Serves as the default hash function.

(Inherited from Object)
GetType()

Gets the Type of the current instance.

(Inherited from Object)
Initialize(String, NameValueCollection)

Implements the initialization procedures required for a Microsoft SQL Server personalization provider. This method is not intended to be used directly from your code.

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

Loads personalization data from the underlying data store, based on the specified parameters.

LoadPersonalizationState(WebPartManager, Boolean)

Loads the raw data from the underlying data store and converts that data into a PersonalizationState object.

(Inherited from PersonalizationProvider)
MemberwiseClone()

Creates a shallow copy of the current Object.

(Inherited from Object)
ResetPersonalizationBlob(WebPartManager, String, String)

Deletes personalization data from the underlying data store.

ResetPersonalizationState(WebPartManager)

Resets personalization data to the underlying data store.

(Inherited from PersonalizationProvider)
ResetState(PersonalizationScope, String[], String[])

Deletes personalization state information from the underlying data store, based on the specified parameters.

ResetUserState(String, DateTime)

Deletes user personalization data from the underlying data store, based on the specified parameters.

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

Saves raw personalization data to the underlying Microsoft SQL Server database.

SavePersonalizationState(PersonalizationState)

Saves personalization data to a data store.

(Inherited from PersonalizationProvider)
ToString()

Returns a string that represents the current object.

(Inherited from Object)

Applies to

See also