Skip to content

Commit f5be50a

Browse files
committed
[ksqlDB.RestApi.Client] - group join, select many QbservableExtensions xml docs
1 parent 51976b4 commit f5be50a

File tree

1 file changed

+36
-6
lines changed

1 file changed

+36
-6
lines changed

ksqlDb.RestApi.Client/KSql/Linq/QbservableExtensions.cs

Lines changed: 36 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using System;
22
using System.Collections.Generic;
3+
using System.Linq;
34
using System.Linq.Expressions;
45
using System.Net.Http;
56
using System.Reactive;
@@ -477,6 +478,19 @@ private static MethodInfo GetGroupJoinMethodInfo<T1, T2, T3, T4, T5, T6>(Func<T1
477478
return f.Method;
478479
}
479480

481+
/// <summary>
482+
/// Correlates the elements of two sequences based on equality of keys and groups the results.
483+
/// </summary>
484+
/// <typeparam name="TOuter">The type of the elements of the first sequence.</typeparam>
485+
/// <typeparam name="TInner">The type of the elements of the second sequence.</typeparam>
486+
/// <typeparam name="TKey">The type of the keys returned by the key selector functions.</typeparam>
487+
/// <typeparam name="TResult">The type of the result elements.</typeparam>
488+
/// <param name="outer">The first sequence to join.</param>
489+
/// <param name="inner">The second sequence to join.</param>
490+
/// <param name="outerKeySelector">A function to extract the join key from each element of the first sequence.</param>
491+
/// <param name="innerKeySelector">A function to extract the join key from each element of the second sequence.</param>
492+
/// <param name="resultSelector">A function to create a result element from an element from the first sequence and a collection of matching elements from the second sequence.</param>
493+
/// <returns>An IQbservable that contains elements of type TResult that are obtained by performing a grouped join on two sequences.</returns>
480494
public static IQbservable<TResult> GroupJoin<TOuter, TInner, TKey, TResult>(this IQbservable<TOuter> outer, ISource<TInner> inner, Expression<Func<TOuter, TKey>> outerKeySelector, Expression<Func<TInner, TKey>> innerKeySelector, Expression<Func<TOuter, IQbservable<TInner>, TResult>> resultSelector)
481495
{
482496
if (outer == null)
@@ -513,6 +527,11 @@ private static MethodInfo DefaultIfEmptyTSource1(Type source) =>
513527
(defaultIfEmptyTSource1 ??= new Func<IQbservable<object>, IQbservable<object>>(DefaultIfEmpty).GetMethodInfo().GetGenericMethodDefinition())
514528
.MakeGenericMethod(source);
515529

530+
/// <summary>
531+
/// An observable sequence that contains the default value for the TSource type if the source is empty; otherwise, the elements of the source itself.
532+
/// </summary>
533+
/// <typeparam name="TSource">The type of the elements of source</typeparam>
534+
/// <param name="source">The sequence to return the specified value for if it is empty.</param>
516535
public static IQbservable<TSource> DefaultIfEmpty<TSource>(this IQbservable<TSource> source)
517536
{
518537
if (source == null)
@@ -528,25 +547,36 @@ public static IQbservable<TSource> DefaultIfEmpty<TSource>(this IQbservable<TSou
528547

529548
#region SelectMany
530549

531-
private static MethodInfo? selectManyTSourceTCollectionTResult3;
550+
private static MethodInfo selectManyTSourceTCollectionTResult3;
532551

533-
private static MethodInfo SelectManyTSourceTCollectionTResult3(Type TSource, Type TCollection, Type TResult) =>
552+
private static MethodInfo SelectManyTSourceTCollectionTResult3(Type source, Type collection, Type result) =>
534553
(selectManyTSourceTCollectionTResult3 ??= new Func<IQbservable<object>, Expression<Func<object, IQbservable<object>>>, Expression<Func<object, object, object>>, IQbservable<object>>(SelectMany).GetMethodInfo().GetGenericMethodDefinition())
535-
.MakeGenericMethod(TSource, TCollection, TResult);
554+
.MakeGenericMethod(source, collection, result);
555+
536556

537-
public static IQbservable<TResult> SelectMany<TSource, TCollection, TResult>(this IQbservable<TSource> source, Expression<Func<TSource, IQbservable<TCollection>>> collectionSelector, Expression<Func<TSource, TCollection, TResult>> resultSelector)
557+
/// <summary>
558+
/// Projects each element of an qbservable sequence to a sequence, invokes the result selector for the source element and each of the corresponding inner sequence's elements, and merges the results into one observable sequence.
559+
/// </summary>
560+
/// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
561+
/// <typeparam name="TSequence">The type of the elements in the projected intermediate enumerable sequences.</typeparam>
562+
/// <typeparam name="TResult">The type of the elements in the result sequence.</typeparam>
563+
/// <param name="source">An observable sequence of elements to project.</param>
564+
/// <param name="collectionSelector">A transform function to apply to each element.</param>
565+
/// <param name="resultSelector">A transform function to apply to each element of the intermediate sequence.</param>
566+
/// <returns>An observable sequence.</returns>
567+
public static IQbservable<TResult> SelectMany<TSource, TSequence, TResult>(this IQbservable<TSource> source, Expression<Func<TSource, IQbservable<TSequence>>> collectionSelector, Expression<Func<TSource, TSequence, TResult>> resultSelector)
538568
{
539569
if (source == null)
540570
throw new ArgumentNullException(nameof(source));
541571
if (collectionSelector == null)
542572
throw new ArgumentNullException(nameof(collectionSelector));
543573
if (resultSelector == null)
544574
throw new ArgumentNullException(nameof(resultSelector));
545-
575+
546576
return source.Provider.CreateQuery<TResult>(
547577
Expression.Call(
548578
null,
549-
SelectManyTSourceTCollectionTResult3(typeof(TSource), typeof(TCollection), typeof(TResult)),
579+
SelectManyTSourceTCollectionTResult3(typeof(TSource), typeof(TSequence), typeof(TResult)),
550580
source.Expression, Expression.Quote(collectionSelector), Expression.Quote(resultSelector)
551581
));
552582
}

0 commit comments

Comments
 (0)