C# (CSharp) Ncqrs.Eventing.Sourcing.Mapping Namespace

Сlasses

Name Description
AttributeBasedDomainSourcedEventHandlerMappingStrategy An internal event handler mapping strategy that creates event handlers based on mapping that is done by attributes. Use the EventHandlerAttribute to mark event handler methods as an event handler. You can only mark methods that following rules: The method should be an instance method (no static). It should accept 1 parameter. The parameter should be, or inherited from, the SourcedEvent class. The method should be marked with the EventHandlerAttribute. public class Foo : AggregateRootMappedWithAttributes { [EventHandler] private void onFooEvent(FooEvent eventToHandle) { // ... } }
ExpressionBasedSourcedEventHandlerMappingStrategy An internal event handler mapping strategy that creates event handlers based on mapping that is done by lambdas. If u inherit from the AggregateRootMappedWithExpressions u must implement the method InitializeEventHandlers(); Inside this method u can define the mapping between an event and an event source method in a strongly typed fashion. public class Foo : AggregateRootMappedWithExpressions { public override void InitializeEventHandlers() { Map{SomethingHappenedEvent}().ToHandler(x => SomethingHasHappened(x)); } public void SomethingHasHappened(SourcedEvent e) {} } public class SomethingHappenedEvent : SourcedEvent {}
MappedAggregateRoot