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()));
        }
Beispiel #2
0
        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()));
        }