在果园 1.6 中,我想获取 Orchard_Users_UserPartRecord 表中的所有记录
我可以通过说得到一个用户:
var user = _membershipService.GetUser(username);
或者
IUser userInfo = _authenticationService.GetAuthenticatedUser();
是否没有某种查询或服务允许我获取所有用户?...我确定有,但我看不到它,所以我尝试添加我自己的...
在membershipService.cs iv中的Orchard.Users模块中添加:
public IEnumerable<IUser> GetAllUsers()
{
return _orchardServices.ContentManager.Query<UserPart, UserPartRecord>().List();
}
IUserService iv 中的 tehn 添加了:
IEnumerable<IUser> AllUsers();
并在 userService iv 中添加:
public IEnumerable<IUser> AllUsers()
{
IEnumerable<IUser> users = _membershipService.//but it doesnt allow me to select GetAllUsers, but it does allow me to seleect
//getUser, iv used the same code only changed the query why isnt it showing?
if (users == null)
return null;
return users;
}
然后我需要让所有用户可以说:
IEnumerable<IUser> allUsers = _userService.AllUsers();
我认为有一项服务已经这样做了,我只是没有看到。有任何想法吗?