コード例 #1
0
        protected bool IsRepeatedCommand(IShipmentTypeCommand command, IEventStoreAggregateId eventStoreAggregateId, IShipmentTypeState state)
        {
            bool repeated = false;

            if (((IShipmentTypeStateProperties)state).Version == command.AggregateVersion + 1)
            {
                if (state.CommandId == command.CommandId)
                {
                    repeated = true;
                }
            }
            return(repeated);
        }
コード例 #2
0
        protected virtual void Update(IShipmentTypeCommand c, Action <IShipmentTypeAggregate> action)
        {
            var aggregateId = c.AggregateId;
            var state       = StateRepository.Get(aggregateId, false);
            var aggregate   = GetShipmentTypeAggregate(state);

            var eventStoreAggregateId = ToEventStoreAggregateId(aggregateId);

            var repeated = IsRepeatedCommand(c, eventStoreAggregateId, state);

            if (repeated)
            {
                return;
            }

            aggregate.ThrowOnInvalidStateTransition(c);
            action(aggregate);
            Persist(eventStoreAggregateId, aggregate, state);
        }
コード例 #3
0
ファイル: ShipmentTypeAggregate.cs プロジェクト: uwitec/wms-8
 private static bool IsCommandCreate(IShipmentTypeCommand c)
 {
     return(c.Version == ShipmentTypeState.VersionZero);
 }