Orchard CMS将自定义零件数据公开给查询过滤器

时间:2012-11-01 16:20:57

标签: orchardcms

我有一个自定义部分“功能”这里是模型

public class FeatureRecord : ContentPartRecord
{
    public virtual bool IsFeatured { get; set; }
    public virtual string Text { get; set; }

}

public class FeaturePart : ContentPart<FeatureRecord>
{
    [Display(Name = "Is featured")]
    public bool IsFeatured
    {
        get { return Record.IsFeatured;  }
        set { Record.IsFeatured = value; }
    }

    [StringLength(400)]
    [Display(Name = "Feature Text")]
    public string FeatureText
    {
        get { return Record.Text; }
        set { Record.Text = value;  }
    }

}

我想为投影窗口小部件设置查询,过滤器偏向IsFeatured值为true

但是,只有已归档的值会显示在过滤器的选项列表中。如何将自定义零件数据公开给过滤器选项值?

1 个答案:

答案 0 :(得分:1)

您可以通过投影下的“绑定”选项卡添加要用于投影的新属性。