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