-->

检索内容,并在果园CMS所有相关的属性(Retrieving content and all ass

2019-10-18 04:31发布

是否有编程方式拉回距离乌内容项的列表的好方法吗?

目前,我这样做,它返回一个ContentPartRecord和名称,但它不以任何方式相当:

public IEnumerable<LookupViewModel> Lookup(string searchText)
    {
        var items = _contentManager
            .Query<MyItemPart, MyItemPartRecord>()
            .Join<TitlePartRecord>()
            .Where(x => x.Title.Contains(searchText))
            .OrderBy(x => x.Title)
            .List();
        return items
            .Select(x => new LookupViewModel()
            {
                Text = x.Name,
                Value = x.Id.ToString()
            });
    }

相关文件的任何指针将不胜感激,有这方面的果园很少。

Answer 1:

避免Contains不惜一切代价。 它会执行可怕。 相反,利用搜索模块。



文章来源: Retrieving content and all associated properties in Orchard CMS