-->

Aggregation and Joins (Inner, Outer, Left, …) with

2019-07-08 02:29发布

问题:

Is there any better way to implement functions like aggregation within a TPL-Dataflow mesh than using a BatchBlock to buffer all items until completion, emit them as a collection and then use a transform block to do the actual aggregation?

Similarly, is there any other way to do an inner/outer/left/right join of two datasets without using a BatchedJoinBlock to buffer all items of both datasources, emit them as a tuple of two collections and then do the actual join with a Transform block?

回答1:

No. There is no such mechanism out-of-the-box in TPL Dataflow, as aggregation and joining operations aren't about flowing, they are about querying the data.

However, as the blocks are perfectly fit with RX library, you can use the Join Patterns in Rx paradigm while aggregating your data.

More related links:

  • Aggregation in Rx
  • Reactive Extensions for .NET (Rx): Take action once all events are completed
  • Guide to System.Reactive.Joins