예제 #1
0
        public static EventTypePatternMatchFrame AddEventHandling(Type aggregateType, IDocumentMapping mapping,
                                                                  params MethodCollection[] collections)
        {
            var byType = new Dictionary <Type, EventProcessingFrame>();

            var frames = new List <EventProcessingFrame>();

            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);

                        byType.Add(frame.EventType, container);

                        frames.Add(container);
                    }
                }
            }

            frames.Sort(new EventTypeComparer());

            return(new EventTypePatternMatchFrame(frames));
        }
예제 #2
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);
        }
예제 #3
0
        public void Configure(EventProcessingFrame parent)
        {
            _aggregate = parent.Aggregate;

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

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

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

            if (ReturnType == parent.AggregateType)
            {
                AssignResultTo(parent.Aggregate);
            }
        }
예제 #5
0
        public void Configure(EventProcessingFrame parent)
        {
            // Replace any arguments to IEvent<T>

            if (Method.GetParameters().Any(x => x.ParameterType == parent.SpecificEvent.VariableType))
            {
                // TODO -- there's a LamarCodeGeneration bug here. It's using CanCastTo(), but should be using an exact match,
                // or looser find of the argument
                TrySetArgument(parent.SpecificEvent);
            }

            // Replace any arguments to the specific T event type
            TrySetArgument(parent.DataOnly);
        }
예제 #6
0
        public void Configure(EventProcessingFrame parent)
        {
            // Replace any arguments to IEvent<T>
            TrySetArgument(parent.SpecificEvent);

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

            if (parent.Aggregate != null)
            {
                AssignResultTo(parent.Aggregate);
            }
            else
            {
                ReturnAction = ReturnAction.Return;
            }
        }
예제 #7
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);
        }
 public void Configure(EventProcessingFrame parent)
 {
     _arg = parent.SpecificEvent.VariableType == _argType ? parent.SpecificEvent : parent.DataOnly;
 }