Linq在StreamInsight中的使用

本文关键字:StreamInsight Linq | 更新日期: 2023-09-27 18:05:32

在StreamInsight中,许多示例解决了linq的用法流的计数、求和、过滤

var cepStream = enumerable.ToPointStream(application, e =>  PointEvent<Car>.CreateInsert(new DateTimeOffset(e.TimeStamp, TimeSpan.Zero), e), AdvanceTimeSettings.IncreasingStartTime);
var step1 = from e in cepStream
                    where e.Color == "RedCar"
                    select e;

在定义提取内部记录的查询时遇到一些困难一定的时间长度。例如,step1存储的点事件是"RedCar",但如何提取10分钟内连续发生的两次"RedCar"事件??

真的被困在这里,任何帮助都是非常感激的!!

Linq在StreamInsight中的使用

要确定两个事件是否在彼此的特定时间内发生,我们必须操作它们的事件生存期,以便它们同时有效。我们可以通过join来确定两个事件是否同时有效。

  1. 将step1的事件时间平移为step2。

    var step2 = from e in step1。ShiftEventTime(e => TimeSpan.FromMinutes(10)) select e;

  2. 将step1的事件持续时间改为step3

    var step3 = from e in step1。AlterEventDuration(e => TimeSpan.FromMinutes(10)) select e;

  3. 将step2和step3连接为step4

有帮助吗?