0

由于 asp.net Membership 不允许通过用户名和电子邮件同时搜索,我认为我应该合并这两个分页结果集中的结果。

以前有人做过吗?或者这是无法实现的想法?

“合并”方法的仅供参考:

MembershipUserCollection FindUsersByName( string usernameToMatch,
                                                                int pageIndex, 
                                                                int pageSize, 
                                                                out int totalRecords )

MembershipUserCollection FindUsersByEmail( string  emailToMatch,
                                                                 int     pageIndex, 
                                                                 int     pageSize, 
                                                                 out int totalRecords )

结果方法签名应如下所示:

MembershipUserCollection MergedUsersAndEmailsSearch( string  userOrEmailToMatch,
                                                             int     pageIndex, 
                                                             int     pageSize, 
                                                             out int totalRecords )
{
//here we calling FindUsersByName and FindUsersByEmail and merging them
}
4

1 回答 1

0

它有效吗?

collection1 = FindUsersByName(...);
collection2 = FindUsersByEmail(...);

collection1.ToList().AddRange(collection2.ToList());
于 2012-04-19T15:33:25.937 回答