public void Dispatch(ICommand<IIdentity> command) { var id = command.Id; var events = LoadEventsFromEventStore(id); var observer = GetObserver(); var taskId = id as TaskId; if (taskId != null) { var state = new TaskAggregateState(events); var agg = new TaskAggregate(state, observer); agg.Execute(command); return; } // other aggregate types // ... throw new Exception( string.Format("Unexpected aggregate id type '{0}'", id.GetType())); }
public void Dispatch(ICommand <IIdentity> command) { var id = command.Id; var events = LoadEventsFromEventStore(id); var observer = GetObserver(); var taskId = id as TaskId; if (taskId != null) { var state = new TaskAggregateState(events); var agg = new TaskAggregate(state, observer); agg.Execute(command); return; } // other aggregate types // ... throw new Exception( string.Format("Unexpected aggregate id type '{0}'", id.GetType())); }
public TaskAggregate(TaskAggregateState state, Action <IEvent <IIdentity> > observer) { this.state = state; this.observer = observer; }
public TaskAggregate(TaskAggregateState state, Action<IEvent<IIdentity>> observer) { this.state = state; this.observer = observer; }