@@ -2952,6 +2952,8 @@ SELECT STRUCT(Property := 42) AS Value FROM Locations EMIT CHANGES;
2952
2952
### multiple joins with query comprehension syntax (GroupJoin, SelectMany, DefaultIfEmpty)
2953
2953
2954
2954
``` C#
2955
+ using ksqlDB .RestApi .Client .KSql .RestApi .Statements .Annotations ;
2956
+
2955
2957
class Order
2956
2958
{
2957
2959
public int OrderId { get ; set ; }
@@ -2961,12 +2963,14 @@ class Order
2961
2963
2962
2964
class Payment
2963
2965
{
2966
+ [Key ]
2964
2967
public int Id { get ; set ; }
2965
2968
}
2966
2969
2967
2970
record Shipment
2968
2971
{
2969
- public int Id { get ; set ; }
2972
+ [Key ]
2973
+ public int ? Id { get ; set ; }
2970
2974
}
2971
2975
```
2972
2976
@@ -3004,6 +3008,48 @@ ON o.ShipmentId = sa.Id
3004
3008
EMIT CHANGES LIMIT 5 ;
3005
3009
```
3006
3010
3011
+ Creation of entities for the above mentioned query:
3012
+
3013
+ ``` C#
3014
+ var entityCreationMetadata = new EntityCreationMetadata
3015
+ {
3016
+ KafkaTopic = nameof (Order ) + " -Join" ,
3017
+ Partitions = 1
3018
+ };
3019
+
3020
+ var response = await restApiClient .CreateStreamAsync <Order >(entityCreationMetadata , ifNotExists : true );
3021
+ response = await restApiClient .CreateTableAsync <Payment >(entityCreationMetadata with { KafkaTopic = nameof (Payment ) }, ifNotExists : true );
3022
+ response = await restApiClient .CreateTableAsync <Shipment >(entityCreationMetadata with { KafkaTopic = nameof (Shipment ) }, ifNotExists : true );
3023
+ ```
3024
+
3025
+ Listen to the incoming record messages:
3026
+
3027
+ ``` C#
3028
+ using var subscription = query
3029
+ .Subscribe (c => {
3030
+ Console .WriteLine ($" {nameof (Order .OrderId )}: {c .orderId }" );
3031
+
3032
+ Console .WriteLine ($" {nameof (Order .PaymentId )}: {c .paymentId }" );
3033
+
3034
+ if (c .shipmentId .HasValue )
3035
+ Console .WriteLine ($" {nameof (Order .ShipmentId )}: {c .shipmentId }" );
3036
+
3037
+ }, error => {
3038
+ Console .WriteLine (error .Message );
3039
+ });
3040
+ ```
3041
+
3042
+ Inserting of sample data:
3043
+
3044
+ ``` C#
3045
+ var order = new Order { OrderId = 1 , PaymentId = 1 , ShipmentId = 1 };
3046
+ var payment = new Payment { Id = 1 };
3047
+ var shipment = new Shipment { Id = 1 };
3048
+
3049
+ response = await restApiClient .InsertIntoAsync (order );
3050
+ response = await restApiClient .InsertIntoAsync (payment );
3051
+ response = await restApiClient .InsertIntoAsync (shipment );
3052
+ ```
3007
3053
3008
3054
# LinqPad samples
3009
3055
[ Push Query] ( https://github.com/tomasfabian/ksqlDB.RestApi.Client-DotNet/tree/main/Samples/ksqlDB.RestApi.Client.LinqPad/ksqlDB.RestApi.Client.linq )
0 commit comments