Exemple #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);
        }
Exemple #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);
        }
Exemple #3
0
 public static CreateShipmentType ToCreateShipmentType(this ShipmentTypeState state)
 {
     return(state.ToCreateShipmentType <CreateShipmentType>());
 }
Exemple #4
0
 public static MergePatchShipmentType ToMergePatchShipmentType(this ShipmentTypeState state)
 {
     return(state.ToMergePatchShipmentType <MergePatchShipmentType>());
 }
Exemple #5
0
 public static DeleteShipmentType ToDeleteShipmentType(this ShipmentTypeState state)
 {
     return(state.ToDeleteShipmentType <DeleteShipmentType>());
 }
Exemple #6
0
 public static IShipmentTypeCommand ToCreateOrMergePatchShipmentType(this ShipmentTypeState state)
 {
     return(state.ToCreateOrMergePatchShipmentType <CreateShipmentType, MergePatchShipmentType>());
 }