using System; using System.Collections.Generic; using System.Linq; using Microsoft.Extensions.DependencyInjection; using Umbraco.Cms.Core.Composing; using Umbraco.Cms.Core.Manifest; namespace Umbraco.Cms.Core.Sections { public class SectionCollectionBuilder : OrderedCollectionBuilderBase { protected override SectionCollectionBuilder This => this; protected override IEnumerable CreateItems(IServiceProvider 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.GetRequiredService(); return base.CreateItems(factory).Concat(manifestParser.CombinedManifest.Sections); } } }