2016-05-27 14:26:28 +02:00
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
using System.Linq;
|
2021-02-18 11:06:02 +01:00
|
|
|
|
using Umbraco.Cms.Core.Xml.XPath;
|
2016-05-27 14:26:28 +02:00
|
|
|
|
|
2021-02-18 11:06:02 +01:00
|
|
|
|
namespace Umbraco.Cms.Infrastructure.PublishedCache.Navigable
|
2016-05-27 14:26:28 +02:00
|
|
|
|
{
|
2017-07-12 14:09:31 +02:00
|
|
|
|
internal class RootContent : INavigableContent
|
2016-05-27 14:26:28 +02:00
|
|
|
|
{
|
|
|
|
|
|
private static readonly RootContentType ContentType = new RootContentType();
|
|
|
|
|
|
private readonly int[] _childIds;
|
|
|
|
|
|
|
|
|
|
|
|
public RootContent(IEnumerable<int> childIds)
|
|
|
|
|
|
{
|
|
|
|
|
|
_childIds = childIds.ToArray();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2017-07-12 14:09:31 +02:00
|
|
|
|
public int Id => -1;
|
2016-05-27 14:26:28 +02:00
|
|
|
|
|
2017-07-12 14:09:31 +02:00
|
|
|
|
public int ParentId => -1;
|
2016-05-27 14:26:28 +02:00
|
|
|
|
|
2017-07-12 14:09:31 +02:00
|
|
|
|
public INavigableContentType Type => ContentType;
|
2016-05-27 14:26:28 +02:00
|
|
|
|
|
2017-07-12 14:09:31 +02:00
|
|
|
|
public IList<int> ChildIds => _childIds;
|
2016-05-27 14:26:28 +02:00
|
|
|
|
|
|
|
|
|
|
public object Value(int index)
|
|
|
|
|
|
{
|
|
|
|
|
|
// only id has a value
|
|
|
|
|
|
return index == 0 ? "-1" : null;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2017-07-12 14:09:31 +02:00
|
|
|
|
private class RootContentType : INavigableContentType
|
2016-05-27 14:26:28 +02:00
|
|
|
|
{
|
2017-07-12 14:09:31 +02:00
|
|
|
|
public string Name => "root";
|
|
|
|
|
|
|
|
|
|
|
|
public INavigableFieldType[] FieldTypes => NavigableContentType.BuiltinProperties;
|
2016-05-27 14:26:28 +02:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|