【问题标题】:In Umbraco 7, how can i search for all members with a custom property?在 Umbraco 7 中,我如何搜索具有自定义属性的所有成员?
【发布时间】:2014-10-23 18:51:22
【问题描述】:

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

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

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

GetByUsername(string username) : returns IMember

也可以通过电子邮件搜索:

GetByEmail(string email) : returns IMember

你知道这种按属性搜索的方法吗?

我尝试过像这样使用“.Where”方法:

GetService().GetAllMembers().Cast<IMember>().Where("permalink=SOMESTRING").ToArray();

很遗憾有一个错误,因为我不能在这里使用 .Where() 方法。

有什么建议吗?

谢谢

【问题讨论】:

    标签: c# linq umbraco umbraco7


    【解决方案1】:

    您可以只使用 MemberService 中的内置函数。

    来自文档:

    Services.MemberService
    
    .GetMembersByPropertyValue("city", "Horsens");
    //Returns all Members, of any type, with a mathcing value in the property with the given property alias
    

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多