We are using the item repository API to fetch some paragraph based items...
var itemids = new[] { "1" };
using (var repository = ItemManager.Storage.Open("Article"))
{
var item = repository.SelectByIds(itemids, null, true).FirstOrDefault();
}
But there seems to be some bugs in the API. Here is some decompiled source code from Dynamicweb.Content.Items.Queries.Repository...
public virtual IEnumerable<Item> SelectByIds(IEnumerable<string> ids, Query query, bool checkPermissions)
{
// Problem 1: Why is the "checkPermissions" parameter ignored here? Shouldn't it be passed on instead?
return this.SelectByIds(ids, query, false, false);
}
public virtual IEnumerable<Item> SelectByIds(IEnumerable<string> ids, Query query, bool checkPermissions, bool includeInheritedItems)
{
// Problem 2: The sql that is generated when checking for permissions is broken.
// One of the conditions checks that ParagraphItemType is in the list of item ids (list2 in the decompiled source code)
...
commandBuilder2.Add("AND ( [Paragraph].[ParagraphItemType] in ({0}) )", new object[1]
{
(object) list2
});
...
}
DW version: 8.6.1.6
Is there a better way to fetch paragraph items AND check for permissions?