public void Configure(EventProcessingFrame parent)
        {
            // Replace any arguments to Event<T>
            TrySetArgument(parent.SpecificEvent);

            // Replace any arguments to the specific T event type
            TrySetArgument(parent.DataOnly);
        }
Exemple #2
0
        public void Configure(EventProcessingFrame parent)
        {
            _aggregate = parent.Aggregate;

            // Replace any arguments to Event<T>
            Maybe.TrySetArgument(parent.SpecificEvent);

            // Replace any arguments to the specific T event type
            Maybe.TrySetArgument(parent.DataOnly);
        }
Exemple #3
0
        public void Configure(EventProcessingFrame parent)
        {
            // Replace any arguments to Event<T>
            TrySetArgument(parent.SpecificEvent);

            // Replace any arguments to the specific T event type
            TrySetArgument(parent.DataOnly);

            if (ReturnType == parent.AggregateType)
            {
                AssignResultTo(parent.Aggregate);
            }
        }
Exemple #4
0
        public static IList <Frame> AddEventHandling(Type aggregateType, DocumentMapping mapping,
                                                     params MethodCollection[] collections)
        {
            var byType = new Dictionary <Type, EventProcessingFrame>();

            // TODO -- later we'll worry about abstract/interface applications
            // of events

            var frames = new List <Frame>();

            var ifStyle = IfStyle.If;

            foreach (var collection in collections)
            {
                foreach (var slot in collection.Methods)
                {
                    var frame = collection.CreateEventTypeHandler(aggregateType, mapping, slot);
                    if (byType.TryGetValue(frame.EventType, out var container))
                    {
                        container.Add((Frame)frame);
                    }
                    else
                    {
                        container = new EventProcessingFrame(aggregateType, frame)
                        {
                            IfStyle = ifStyle
                        };

                        ifStyle = IfStyle.ElseIf;

                        byType.Add(frame.EventType, container);

                        frames.Add(container);
                    }
                }
            }

            return(frames);
        }