Exemplo n.º 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);
        }
Exemplo n.º 3
0
 public static CreateOrderShipment ToCreateOrderShipment(this OrderShipmentState state)
 {
     return(state.ToCreateOrderShipment <CreateOrderShipment>());
 }
Exemplo n.º 4
0
 public static MergePatchOrderShipment ToMergePatchOrderShipment(this OrderShipmentState state)
 {
     return(state.ToMergePatchOrderShipment <MergePatchOrderShipment>());
 }
Exemplo n.º 5
0
 public static DeleteOrderShipment ToDeleteOrderShipment(this OrderShipmentState state)
 {
     return(state.ToDeleteOrderShipment <DeleteOrderShipment>());
 }
Exemplo n.º 6
0
 public static IOrderShipmentCommand ToCreateOrMergePatchOrderShipment(this OrderShipmentState state)
 {
     return(state.ToCreateOrMergePatchOrderShipment <CreateOrderShipment, MergePatchOrderShipment>());
 }