PersonalizationProvider.GetCountOfState Method

Note: This method is new in the .NET Framework version 2.0.

When overridden in a derived class, returns the number of rows in the underlying data store that exist within the specified scope.

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

public abstract int GetCountOfState (
	PersonalizationScope scope,
	PersonalizationStateQuery query
)
public abstract int GetCountOfState (
	PersonalizationScope scope, 
	PersonalizationStateQuery query
)
public abstract function GetCountOfState (
	scope : PersonalizationScope, 
	query : PersonalizationStateQuery
) : int

Parameters

scope

A PersonalizationScope of the personalization information to be queried. This value cannot be a null reference (Nothing in Visual Basic).

query

A PersonalizationStateQuery containing a query. This value can be a null reference (Nothing in Visual Basic).

Return Value

The number of rows in the underlying data store that exist for the specified scope parameter.

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

This method passes query wildcard characters to the underlying data store. Support for wildcard characters is currently dependent on how each provider handles characters such as an asterisk (*), a percent symbol (%), or an underscore (_).

Normally, for SQL-compliant data stores, you can perform a wildcard search on a partial path with the wildcard character appearing at the beginning, the end, or the middle of the search string text in the PathToMatch property. For example, to find all paths that start with "~/vdir", the PathToMatch property would be set to "~/vdir%".

Likewise, a wildcard search on a partial user name could have the wildcard character appear at any point in the text string of the UsernameToMatch property. For example, to find all user names that start with "John", the UsernameToMatch parameter would look like "John%".

The following query constraints apply:

  • If only scope is provided, and query is a null reference (Nothing in Visual Basic) or all the properties on query return either a null reference (Nothing in Visual Basic) or default values, then all records matching the indicated scope parameter are counted.

  • If the PathToMatch property is not a null reference (Nothing in Visual Basic), the counted records are also filtered based on paths that match the PathToMatch value.

  • If the UsernameToMatch property is not a null reference (Nothing in Visual Basic), the counted records are also filtered based on user names that match the UsernameToMatch property value.

  • If the UserInactiveSinceDate property is not equal to MaxValue, then the counted records are also filtered to return only those records associated with inactive users. The comparison includes records where the LastActivityDate property is less than or equal to the UserInactiveSinceDate property.

Note that this method does not validate combinations of query parameters. For example, code can request a count of personalization state records associated with a specific user name in the shared scope. Because user names are not associated with shared information, the returned count would be zero.

Parameter combinations that have the potential to return a non-zero count include:

  • Shared scope in combination with the PathToMatch property.

  • User scope in combination with the values for any or all of the PathToMatch, UsernameToMatch, and UserInactiveSinceDate properties.

Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

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

.NET Framework

Supported in: 2.0

Community Additions

ADD
Show: