ProfileProvider.FindInactiveProfilesByUserName 方法

定义

在派生类中重写后,此方法检索最后一次活动在指定日期或指定日期之前发生并且用户名与指定用户名相匹配的配置文件的配置文件信息。

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

参数

authenticationOption
ProfileAuthenticationOption

ProfileAuthenticationOption 值之一,指定是返回匿名配置文件、经过身份验证的配置文件还是同时返回这两种类型的配置文件。

usernameToMatch
String

要搜索的用户名。

userInactiveSinceDate
DateTime

一个 DateTime,确定将哪些用户配置文件视为处于不活动状态。 如果用户配置文件的 LastActivityDate 值与此日期和时间相同,或在此日期和时间之前,则此配置文件被视为处于不活动状态。

pageIndex
Int32

要返回的结果页的索引。

pageSize
Int32

要返回的结果页的大小。

totalRecords
Int32

当此方法返回时,此参数包含配置文件的总数。

返回

ProfileInfoCollection

包含不活动配置文件的用户配置文件信息的 ProfileInfoCollection,这些不活动配置文件中的用户名与提供的 usernameToMatch 参数相匹配。

示例

下面的代码示例演示方法实现 FindInactiveProfilesByUserName 的方法签名。 有关完整 ProfileProvider 实现的示例,请参阅 如何:生成和运行配置文件提供程序示例

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

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

  totalRecords = 0

  Return New ProfileInfoCollection()
End Function

注解

该方法 FindInactiveProfilesByUserName 用于检索配置文件信息,以获取配置文件中未使用的用户配置文件,其中用户名与提供的 usernameToMatch 参数匹配。 仅返回配置文件中指定的数据 applicationName 。 该 authenticationOption 参数指定仅搜索匿名配置文件、仅经过身份验证的配置文件或所有配置文件。 在搜索配置文件中,返回 LastActivityDate 指定 userInactiveSinceDate 参数值之前发生的任何配置文件。

如果数据源支持其他搜索功能,例如通配符,则可以为用户名提供更广泛的搜索功能。

返回 FindInactiveProfilesByUserName 的结果受 pageIndex 参数的约束 pageSize 。 该pageSize参数标识在 . ProfileInfoCollection中返回的最大对象数ProfileInfo。 该 pageIndex 参数标识要返回的结果页,其中零标识第一页。 该totalRecords参数是一个out参数,该参数根据参数userInactiveSinceDate设置为配置的applicationName``authenticationOption非活动用户配置文件总数。 例如,如果配置applicationName有 13 个用户,并且值为 1 pageSizepageIndex值为 5,则ProfileInfoCollection返回的用户将包含返回的第六个到第十个非活动配置文件。 参数 totalRecords 将设置为 13。

适用于

另请参阅