简体   繁体   English

ASP.NET成员资格搜索

[英]ASP.NET Membership Search

I did not find any Complete Search for ASP.NET Membership. 我没有找到对ASP.NET成员资格的任何完整搜索。 for example i want to search a user with this detail : Username , Creation Date, last Activity Date , Last Login Date , Email , IsUserOnline,IsApproved , IsLockedOut , Has this Roles , Has Not This Roles . 例如,我想用以下详细信息搜索用户:用户名,创建日期,上次活动日期,上次登录日期,电子邮件,IsUserOnline,IsApproved,IsLockedOut,具有此角色,没有此角色。 have i load all users in RAM and filter them Server Side ? 我是否已将所有用户加载到RAM中并过滤了服务器端? this way has bad performance . 这种方式性能不好。 is there any better exist ? 有更好的存在吗?

If the Membership framework doesn't provide the full search functionality you need you could implement a custom membership provider which delivers the specific functionality you need. 如果成员资格框架不能提供您所需的全部搜索功能,则可以实施自定义成员资格提供程序,以提供所需的特定功能。

If that's too much work, then just roll some stored procedures to query the database yourself and call them when needed. 如果工作量太大,则只需滚动一些存储过程即可自己查询数据库,并在需要时调用它们。 It's not as tidy as keeping everything in the one place, but the schema is pretty simple. 它不像将所有内容都放在一个地方一样整洁,但是架构非常简单。

Implementing a Membership Provider 实施会员提供者

the Membership did not provide search functions for the one you ask. Membership没有为您要求的Membership提供搜索功能。

You can use the Membership.FindUsersByName , Membership.GetUserNameByEmail and some more that you can find on msdn , but not the other. 您可以使用Membership.FindUsersByNameMembership.GetUserNameByEmail以及可以在msdn上找到的其他对象,但不能使用其他对象。

If you have few users that are stored on your web.config file, then just load them all and make your search as you say. 如果存储在web.config文件中的用户很少,则只需全部加载并按照您的要求进行搜索。

If from the other hand you use a database, then you can connect to the database and get your informations you ask by simple sql query. 另一方面,如果您使用数据库,则可以连接到该数据库并通过简单的sql查询获得所需的信息。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM