ProfileProvider.FindProfilesByUserName(ProfileAuthenticationOption, String, Int32, Int32, Int32) ProfileProvider.FindProfilesByUserName(ProfileAuthenticationOption, String, Int32, Int32, Int32) ProfileProvider.FindProfilesByUserName(ProfileAuthenticationOption, String, Int32, Int32, Int32) ProfileProvider.FindProfilesByUserName(ProfileAuthenticationOption, String, Int32, Int32, Int32) Method

定义

在派生类中重写后,此方法检索用户名与指定用户名相匹配的配置文件的配置文件信息。When overridden in a derived class, retrieves profile information for profiles in which the user name matches the specified user names.

public:
 abstract System::Web::Profile::ProfileInfoCollection ^ FindProfilesByUserName(System::Web::Profile::ProfileAuthenticationOption authenticationOption, System::String ^ usernameToMatch, int pageIndex, int pageSize, [Runtime::InteropServices::Out] int % totalRecords);
public abstract System.Web.Profile.ProfileInfoCollection FindProfilesByUserName (System.Web.Profile.ProfileAuthenticationOption authenticationOption, string usernameToMatch, int pageIndex, int pageSize, out int totalRecords);
abstract member FindProfilesByUserName : System.Web.Profile.ProfileAuthenticationOption * string * int * int * int -> System.Web.Profile.ProfileInfoCollection
Public MustOverride Function FindProfilesByUserName (authenticationOption As ProfileAuthenticationOption, usernameToMatch As String, pageIndex As Integer, pageSize As Integer, ByRef totalRecords As Integer) As ProfileInfoCollection

参数

authenticationOption
ProfileAuthenticationOption ProfileAuthenticationOption ProfileAuthenticationOption ProfileAuthenticationOption

ProfileAuthenticationOption 值之一,指定是返回匿名配置文件、经过身份验证的配置文件还是同时返回这两种类型的配置文件。One of the ProfileAuthenticationOption values, specifying whether anonymous, authenticated, or both types of profiles are returned.

usernameToMatch
String String String String

要搜索的用户名。The user name to search for.

pageIndex
Int32 Int32 Int32 Int32

要返回的结果页的索引。The index of the page of results to return.

pageSize
Int32 Int32 Int32 Int32

要返回的结果页的大小。The size of the page of results to return.

totalRecords
Int32 Int32 Int32 Int32

当此方法返回时,此参数包含配置文件的总数。When this method returns, contains the total number of profiles.

返回

包含配置文件中的用户配置文件信息的 ProfileInfoCollection,这些配置文件中的用户名与提供的 usernameToMatch 参数相匹配。A ProfileInfoCollection containing user-profile information for profiles where the user name matches the supplied usernameToMatch parameter.

示例

下面的代码示例演示FindProfilesByUserName方法的实现的方法签名。The following code example shows the method signature for an implementation of the FindProfilesByUserName method. 有关完整ProfileProvider实现的示例,请参阅如何:生成并运行配置文件提供程序示例。For an example of a full ProfileProvider implementation, see How to: Build and Run the Profile Provider Example.

public override ProfileInfoCollection FindProfilesByUserName(
    ProfileAuthenticationOption authenticationOption,
    string usernameToMatch,
    int pageIndex,
    int pageSize,
    out int totalRecords)
{
    totalRecords = 0;

    return new ProfileInfoCollection();
}
Public Overrides Function FindProfilesByUserName( _
ByVal authenticationOption As ProfileAuthenticationOption, _
ByVal usernameToMatch As String, _
ByVal pageIndex As Integer, _
ByVal pageSize As Integer, _
 ByRef totalRecords As Integer) As ProfileInfoCollection

  totalRecords = 0

  Return New ProfileInfoCollection()
End Function

注解

方法返回配置文件的配置文件信息列表,其中的用户名与提供usernameToMatch的参数相匹配。 FindProfilesByUserNameThe FindProfilesByUserName method returns a list of profile information for profiles in which the user name matches the supplied usernameToMatch parameter. 仅返回配置文件applicationName中指定的数据。Only data for the applicationName specified in the configuration file is returned. authenticationOption参数指定是否仅搜索匿名配置文件、是否仅搜索已通过身份验证的配置文件或所有配置文件。The authenticationOption parameter specifies whether only anonymous profiles, only authenticated profiles, or all profiles are searched.

如果数据源支持其他搜索功能(如通配符),则可以为用户名提供更广泛的搜索功能。If your data source supports additional search capabilities, such as wildcard characters, you can provide more extensive search capabilities for user names.

返回FindProfilesByUserName的结果是pageIndex由和pageSize参数约束的。The results returned by FindProfilesByUserName are constrained by the pageIndex and pageSize parameters. 参数标识要在中返回的ProfileInfo ProfileInfoCollection对象的最大数目。 pageSizeThe pageSize parameter identifies the maximum number of ProfileInfo objects to return in the ProfileInfoCollection. pageIndex参数标识要返回的结果页,其中零标识第一页。The pageIndex parameter identifies which page of results to return, where zero identifies the first page. out applicationName authenticationOption参数是一个参数,该参数设置为基于和userInactiveSinceDate参数配置的非活动用户配置文件的总数。 totalRecordsThe totalRecords parameter is an out parameter that is set to the total number of inactive user profiles for the configured applicationName, based on the authenticationOption and userInactiveSinceDate parameters. applicationName例如,如果配置的有13个用户, pageIndex并且pageSize值为1且为5,则ProfileInfoCollection返回的将包含返回的第六个非活动配置文件。For example, if there are 13 users for the configured applicationName, and the pageIndex value is 1 with a pageSize of 5, the ProfileInfoCollection returned would contain the sixth through the tenth inactive profiles returned. totalRecords参数将设置为13。The totalRecords parameter would be set to 13.

适用于

另请参阅