Exemplo n.º 1
0
        public virtual IPickwaveState ToPickwaveState()
        {
            var state = new PickwaveState(true);

            state.PickwaveId  = this.PickwaveId;
            state.StatusId    = this.StatusId;
            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);
        }
Exemplo n.º 2
0
        public virtual void Initialize(IPickwaveStateCreated stateCreated)
        {
            var aggregateId = stateCreated.PickwaveEventId.PickwaveId;
            var state       = new PickwaveState();

            state.PickwaveId = aggregateId;
            var aggregate = (PickwaveAggregate)GetPickwaveAggregate(state);

            var eventStoreAggregateId = ToEventStoreAggregateId(aggregateId);

            aggregate.Apply(stateCreated);
            Persist(eventStoreAggregateId, aggregate, state);
        }
Exemplo n.º 3
0
 public static CreatePickwave ToCreatePickwave(this PickwaveState state)
 {
     return(state.ToCreatePickwave <CreatePickwave>());
 }
Exemplo n.º 4
0
 public static MergePatchPickwave ToMergePatchPickwave(this PickwaveState state)
 {
     return(state.ToMergePatchPickwave <MergePatchPickwave>());
 }
Exemplo n.º 5
0
 public static DeletePickwave ToDeletePickwave(this PickwaveState state)
 {
     return(state.ToDeletePickwave <DeletePickwave>());
 }
Exemplo n.º 6
0
 public static IPickwaveCommand ToCreateOrMergePatchPickwave(this PickwaveState state)
 {
     return(state.ToCreateOrMergePatchPickwave <CreatePickwave, MergePatchPickwave>());
 }