Modifier

Partager via


PersonalizationProvider.ResetState Method

Definition

When overridden in a derived class, deletes personalization state from the underlying data store based on the specified parameters.

public:
 abstract int ResetState(System::Web::UI::WebControls::WebParts::PersonalizationScope scope, cli::array <System::String ^> ^ paths, cli::array <System::String ^> ^ usernames);
public abstract int ResetState (System.Web.UI.WebControls.WebParts.PersonalizationScope scope, string[] paths, string[] usernames);
abstract member ResetState : System.Web.UI.WebControls.WebParts.PersonalizationScope * string[] * string[] -> int
Public MustOverride Function ResetState (scope As PersonalizationScope, paths As String(), usernames As String()) As Integer

Parameters

scope
PersonalizationScope

A PersonalizationScope of the personalization information to be reset. This value cannot be null.

paths
String[]

The paths for personalization information to be deleted.

usernames
String[]

The user names for personalization information to be deleted.

Returns

The number of rows deleted.

Remarks

This method is the abstract definition of an administrative method for deleting personalization data. Derived implementations should follow the logic described below.

No wildcard character searches are supported by this method. If the personalization provider exposes data from a transaction-aware data store, this method should perform its operations as a single atomic transaction.

Only the following combinations of parameters are allowed:

  • The scope parameter is set, and all other parameters are set to null. This combination deletes all Web Parts personalization data associated with the personalization scope indicated by scope.

  • The scope parameter is set, and the paths parameter contains at least one value. This combination deletes all Web Parts personalization data for the specified path or paths in the personalization scope indicated by scope.

  • The scope parameter is set to User, the paths parameter is set and contains only one value, and the usernames parameter contains at least one value. This combination deletes all user personalization Web Parts data for the given path that is associated with the user or users contained in usernames.

  • The scope parameter is set to User, the paths parameter is set to null, and the usernames parameter contains at least one value. This combination deletes all per-user personalization Web Parts data, across all paths, associated with the user or users contained in usernames.

Any other combination of parameter values is invalid and will throw an ArgumentException exception. Specifically, the following two combinations are not allowed:

  • The usernames parameter cannot be provided when scope is set to Shared.

  • The paths parameter cannot contain more than one entry when the usernames parameter is not null.

Any paths and usernames parameter values contained within the respective arrays must meet the following validation rules. If any validation rules fail for any member of the parameter arrays, an ArgumentException exception is thrown. The validation rules are:

  • null values are not allowed.

  • An empty string ("") is not allowed. Parameters should be trimmed prior to performing an empty string check.

  • The usernames parameter cannot contain commas (,).

  • The length of the paths parameter cannot be greater than 256 characters for a SQL database.

  • The length of the usernames parameter cannot be greater than 256 characters for a SQL database.

Applies to