Renamed the project to Umbraco.PublishedCache.NuCache - and move non NuCache related stuff to abstractions and infrastructure.
This commit is contained in:
33
src/Umbraco.PublishedCache.NuCache/Navigable/Source.cs
Normal file
33
src/Umbraco.PublishedCache.NuCache/Navigable/Source.cs
Normal file
@@ -0,0 +1,33 @@
|
||||
using System.Linq;
|
||||
using Umbraco.Core.Xml.XPath;
|
||||
|
||||
namespace Umbraco.Web.PublishedCache.NuCache.Navigable
|
||||
{
|
||||
internal class Source : INavigableSource
|
||||
{
|
||||
private readonly INavigableData _data;
|
||||
private readonly bool _preview;
|
||||
private readonly RootContent _root;
|
||||
|
||||
public Source(INavigableData data, bool preview)
|
||||
{
|
||||
_data = data;
|
||||
_preview = preview;
|
||||
|
||||
var contentAtRoot = data.GetAtRoot(preview);
|
||||
_root = new RootContent(contentAtRoot.Select(x => x.Id));
|
||||
}
|
||||
|
||||
public INavigableContent Get(int id)
|
||||
{
|
||||
// wrap in a navigable content
|
||||
|
||||
var content = _data.GetById(_preview, id);
|
||||
return content == null ? null : new NavigableContent(content);
|
||||
}
|
||||
|
||||
public int LastAttributeIndex => NavigableContentType.BuiltinProperties.Length - 1;
|
||||
|
||||
public INavigableContent Root => _root;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user