Files
Umbraco-CMS/src/Umbraco.Core/Sections/SectionCollectionBuilder.cs
2020-02-24 08:21:53 +01:00

25 lines
945 B
C#

using System.Collections.Generic;
using System.Linq;
using Umbraco.Core;
using Umbraco.Core.Composing;
using Umbraco.Core.Manifest;
using Umbraco.Core.Models.Sections;
namespace Umbraco.Web.Sections
{
public class SectionCollectionBuilder : OrderedCollectionBuilderBase<SectionCollectionBuilder, SectionCollection, ISection>
{
protected override SectionCollectionBuilder This => this;
protected override IEnumerable<ISection> CreateItems(IFactory factory)
{
// get the manifest parser just-in-time - injecting it in the ctor would mean that
// simply getting the builder in order to configure the collection, would require
// its dependencies too, and that can create cycles or other oddities
var manifestParser = factory.GetInstance<IManifestParser>();
return base.CreateItems(factory).Concat(manifestParser.Manifest.Sections);
}
}
}