public override Task <IExecutionResult> Handle(Resource aggregate, CreateResourceCommand command) { if (aggregate.IsNew) { var aggregateEvent = new ResourceCreatedEvent(); aggregate.Emit(aggregateEvent); var executionResult = new SuccessExecutionResult(); return(Task.FromResult <IExecutionResult>(executionResult)); } else { var executionResult = new FailedExecutionResult(new List <System.String> { "aggregate is already created" }); return(Task.FromResult <IExecutionResult>(executionResult)); } }
public override void Handle( Resource aggregate, IActorContext context, CreateResourceCommand command) { if (aggregate.IsNew) { var aggregateEvent = new ResourceCreatedEvent(); aggregate.Emit(aggregateEvent); var executionResult = new SuccessExecutionResult(); context.Sender.Tell(executionResult); } else { var executionResult = new FailedExecutionResult("aggregate is already created"); context.Sender.Tell(executionResult); } }
public void Apply(ResourceCreatedEvent aggregateEvent) { //nothing to be done }
public void Apply(ResourceCreatedEvent _) { }