public static Option <TItem> ResolveAs <TItem>(this ITemplateMapping mapping, Item item) where TItem : IItem { if (mapping == null) { throw new ArgumentNullException(nameof(mapping)); } if (item == null) { throw new ArgumentNullException(nameof(item)); } return(mapping.Resolve(item).SomeWhen(i => i is TItem).Map(i => (TItem)i)); }
public IEnumerable <IItem> AncestorsAndSelf() => Ancestors().Concat(new[] { mapping.Resolve(ownerItem) }).ToArray();