/// <summary> /// Returns all IEntity constructs in the source sequence which have been bound as the /// Direct OR Indirect Object of any IVerbal construct which conforms the logic of the /// IVerbal selector function. /// </summary> /// <typeparam name="TEntity">Any Type which implements the IEntity interface.</typeparam> /// <param name="entities">The sequence of IEntity constructs to filter.</param> /// <param name="predicate"> /// The function which examines the IndirectObjectOf property of each entity to determine if /// it should be included in the resulting sequence. /// </param> /// <returns> /// All IEntity constructs in the source sequence which have been bound as the Direct OR /// Indirect Object of any IVerbal construct which conforms the logic of the IVerbal /// selector function. /// </returns> public static ParallelQuery <TEntity> InObjectRole <TEntity>(this ParallelQuery <TEntity> entities, Func <IVerbal, bool> predicate) where TEntity : IEntity { var direct = entities.InDirectObjectRole(predicate).AsSequential(); var indirect = entities.InIndirectObjectRole(predicate).AsSequential(); return(direct.Union(indirect).AsParallel().WithDegreeOfParallelism(Concurrency.Max)); }
/// <summary> /// Returns all IEntity constructs in the source sequence which have been bound as the /// Direct Object of any IVerbal construct which conforms the logic of the IVerbal selector function. /// </summary> /// <typeparam name="TEntity">Any Type which implements the IEntity interface.</typeparam> /// <param name="entities">The sequence of IEntity constructs to filter.</param> /// <param name="predicate"> /// The function which examines the DirectObjectOf property of each entity to determine if /// it should be included in the resulting sequence. /// </param> /// <returns> /// All IEntity constructs in the source sequence which have been bound as the Direct Object /// of any IVerbal construct which conforms the logic of the IVerbal selector function. /// </returns> public static ParallelQuery <TEntity> InDirectObjectRole <TEntity>(this ParallelQuery <TEntity> entities, Func <IVerbal, bool> predicate) where TEntity : IEntity => from e in entities.InDirectObjectRole() where e.DirectObjectOf.Match(predicate) select e;