Beispiel #1
0
        public virtual IOrderShipmentState ToOrderShipmentState()
        {
            var state = new OrderShipmentState(true);

            state.OrderShipmentId = this.OrderShipmentId;
            state.Quantity        = this.Quantity;
            if (this.Active != null && this.Active.HasValue)
            {
                state.Active = this.Active.Value;
            }
            if (this.Version != null && this.Version.HasValue)
            {
                state.Version = this.Version.Value;
            }
            state.CreatedBy = this.CreatedBy;
            if (this.CreatedAt != null && this.CreatedAt.HasValue)
            {
                state.CreatedAt = this.CreatedAt.Value;
            }
            state.UpdatedBy = this.UpdatedBy;
            if (this.UpdatedAt != null && this.UpdatedAt.HasValue)
            {
                state.UpdatedAt = this.UpdatedAt.Value;
            }

            return(state);
        }
        public virtual void Initialize(IOrderShipmentStateCreated stateCreated)
        {
            var aggregateId = stateCreated.OrderShipmentEventId.OrderShipmentId;
            var state       = new OrderShipmentState();

            state.OrderShipmentId = aggregateId;
            var aggregate = (OrderShipmentAggregate)GetOrderShipmentAggregate(state);

            var eventStoreAggregateId = ToEventStoreAggregateId(aggregateId);

            aggregate.Apply(stateCreated);
            Persist(eventStoreAggregateId, aggregate, state);
        }
 public static CreateOrderShipment ToCreateOrderShipment(this OrderShipmentState state)
 {
     return(state.ToCreateOrderShipment <CreateOrderShipment>());
 }
 public static MergePatchOrderShipment ToMergePatchOrderShipment(this OrderShipmentState state)
 {
     return(state.ToMergePatchOrderShipment <MergePatchOrderShipment>());
 }
 public static DeleteOrderShipment ToDeleteOrderShipment(this OrderShipmentState state)
 {
     return(state.ToDeleteOrderShipment <DeleteOrderShipment>());
 }
 public static IOrderShipmentCommand ToCreateOrMergePatchOrderShipment(this OrderShipmentState state)
 {
     return(state.ToCreateOrMergePatchOrderShipment <CreateOrderShipment, MergePatchOrderShipment>());
 }