/// <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 /// 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 Indirect /// Object of any IVerbal construct which conforms the logic of the IVerbal selector function. /// </returns> public static ParallelQuery <TEntity> InIndirectObjectRole <TEntity>(this ParallelQuery <TEntity> entities, Func <IVerbal, bool> predicate) where TEntity : IEntity => from e in entities.InIndirectObjectRole() where predicate(e.IndirectObjectOf) select e;