在Umbraco 7中,如何使用自定义属性搜索所有成员?

Han*_*utz 4 c# linq umbraco umbraco7

我正在使用Umbraco 7(C#).

有没有一种简单的方法/方法来搜索具有自定义属性的所有成员?

我知道有一种简单的方法可以使用该方法通过用户名搜索所有成员

GetByUsername(string username) : returns IMember
Run Code Online (Sandbox Code Playgroud)

并通过电子邮件进行搜索:

GetByEmail(string email) : returns IMember
Run Code Online (Sandbox Code Playgroud)

你知道这种搜查财产的方法吗?

我尝试过使用方法".Where",如下所示:

GetService().GetAllMembers().Cast<IMember>().Where("permalink=SOMESTRING").ToArray();
Run Code Online (Sandbox Code Playgroud)

不幸的是有一个错误,因为我不能在这里使用.Where()方法.

有什么建议?

谢谢

小智 12

您可以在MemberService中使用build in函数.

来自doc:

Services.MemberService

.GetMembersByPropertyValue("city", "Horsens");
//Returns all Members, of any type, with a mathcing value in the property with the given property alias
Run Code Online (Sandbox Code Playgroud)

http://our.umbraco.org/documentation/Reference/Management-v6/Services/MemberService