Esempio n. 1
0
 public void FanOut <TEvent, TChild>(Func <TEvent, IEnumerable <TChild> > fanOutFunc, FanoutMode mode = FanoutMode.AfterGrouping)
 {
     _defaultSlicer.FanOut(fanOutFunc, mode);
 }
Esempio n. 2
0
        /// <summary>
        /// Apply "fan out" operations to the given TEvent type that inserts an enumerable of TChild events right behind the parent
        /// event in the event stream
        /// </summary>
        /// <param name="fanOutFunc"></param>
        /// <param name="mode">Should the fan out operation happen after grouping, or before? Default is after</param>
        /// <typeparam name="TEvent"></typeparam>
        /// <typeparam name="TChild"></typeparam>
        public EventSlicer <TDoc, TId> FanOut <TEvent, TChild>(Func <TEvent, IEnumerable <TChild> > fanOutFunc, FanoutMode mode = FanoutMode.AfterGrouping)
        {
            var fanout = new FanOutOperator <TEvent, TChild>(fanOutFunc)
            {
                Mode = mode
            };

            switch (mode)
            {
            case FanoutMode.AfterGrouping:
                _afterGroupingFanoutRules.Add(fanout);
                break;

            case FanoutMode.BeforeGrouping:
                _beforeGroupingFanoutRules.Add(fanout);
                break;
            }

            return(this);
        }