예제 #1
0
        public async Task <IEnumerable <Func <IEventData, Task <Effect> > > > GetReactionsFor(IEventData e)
        {
            var result = new List <Func <IEventData, Task <Effect> > >();

            foreach (var reaction in reactions)
            {
                var isAncestor = await storage.IsEventAncestor(reaction.Key, e.ValueID);

                if (isAncestor)
                {
                    foreach (var item in reaction.Value)
                    {
                        result.Add(item);
                    }
                }
            }

            if (0 == result.Count)
            {
                throw new Exception("No reactions defined for " + e.ID);
            }

            return(result);
        }