using System.Collections.Generic; using System.Linq; using FluentValidation; using Gallium; using Nitride.Entities; using Serilog; using Zio; namespace Nitride.IO.Paths; [WithProperties] public partial class LinkDirectChildren : CreateOrUpdateIndex { /// public LinkDirectChildren(ILogger logger, IValidator validator) : base(logger, validator) { this.UpdateIndex = this.InternalUpdateIndex; this.GetIndexKey = e => e.Get().GetDirectoryIndexPath(); } /// public override IEnumerable Run(IEnumerable input) { if (this.Scanner != null!) { return base.Run(input); } this.Scanner = new DirectChildPathScanner(new EntityScannerValidator()); input = this.Scanner.Run(input).ToList(); return base.Run(input); } private Entity InternalUpdateIndex(Entity entity, string _, IEnumerable list) { return entity.Add(new DirectChildEntityList(list)); } }