Example #1
0
        public virtual IShipmentTypeState ToShipmentTypeState()
        {
            var state = new ShipmentTypeState(true);

            state.ShipmentTypeId = this.ShipmentTypeId;
            state.ParentTypeId   = this.ParentTypeId;
            state.HasTable       = this.HasTable;
            state.Description    = this.Description;
            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);
        }
Example #2
0
        public virtual void Initialize(IShipmentTypeStateCreated stateCreated)
        {
            var aggregateId = stateCreated.ShipmentTypeEventId.ShipmentTypeId;
            var state       = new ShipmentTypeState();

            state.ShipmentTypeId = aggregateId;
            var aggregate = (ShipmentTypeAggregate)GetShipmentTypeAggregate(state);

            var eventStoreAggregateId = ToEventStoreAggregateId(aggregateId);

            aggregate.Apply(stateCreated);
            Persist(eventStoreAggregateId, aggregate, state);
        }
Example #3
0
 public static CreateShipmentType ToCreateShipmentType(this ShipmentTypeState state)
 {
     return(state.ToCreateShipmentType <CreateShipmentType>());
 }
Example #4
0
 public static MergePatchShipmentType ToMergePatchShipmentType(this ShipmentTypeState state)
 {
     return(state.ToMergePatchShipmentType <MergePatchShipmentType>());
 }
Example #5
0
 public static DeleteShipmentType ToDeleteShipmentType(this ShipmentTypeState state)
 {
     return(state.ToDeleteShipmentType <DeleteShipmentType>());
 }
Example #6
0
 public static IShipmentTypeCommand ToCreateOrMergePatchShipmentType(this ShipmentTypeState state)
 {
     return(state.ToCreateOrMergePatchShipmentType <CreateShipmentType, MergePatchShipmentType>());
 }