protected override bool ReceiveRecover(object message)
        {
            var offer = message as SnapshotOffer;
            var offeredState = offer?.Snapshot as AccountEntity;

            if (offeredState != null)
            {
                _state = offeredState;
                return true;
            }

            var domainEvent = message as IEvent;
            if (domainEvent != null)
            {
                UpdateState(domainEvent);
                return true;
            }
            return false;
        }
Beispiel #2
0
        protected override bool ReceiveRecover(object message)
        {
            var offer        = message as SnapshotOffer;
            var offeredState = offer?.Snapshot as AccountEntity;

            if (offeredState != null)
            {
                _state = offeredState;
                return(true);
            }

            var domainEvent = message as IEvent;

            if (domainEvent != null)
            {
                UpdateState(domainEvent);
                return(true);
            }
            return(false);
        }
 public AccountAggregate(Guid id)
 {
     _id = id;
     _state = new AccountEntity(id);
     _stateHandler = new AccountStateHandler(() => _state);
 }
Beispiel #4
0
 public AccountAggregate(Guid id)
 {
     _id           = id;
     _state        = new AccountEntity(id);
     _stateHandler = new AccountStateHandler(() => _state);
 }