public virtual IStatusItemState ToStatusItemState() { var state = new StatusItemState(true); state.StatusId = this.StatusId; state.StatusTypeId = this.StatusTypeId; state.StatusCode = this.StatusCode; state.SequenceId = this.SequenceId; 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); }
public virtual void Initialize(IStatusItemStateCreated stateCreated) { var aggregateId = stateCreated.StatusItemEventId.StatusId; var state = new StatusItemState(); state.StatusId = aggregateId; var aggregate = (StatusItemAggregate)GetStatusItemAggregate(state); var eventStoreAggregateId = ToEventStoreAggregateId(aggregateId); aggregate.Apply(stateCreated); Persist(eventStoreAggregateId, aggregate, state); }
public static CreateStatusItem ToCreateStatusItem(this StatusItemState state) { return(state.ToCreateStatusItem <CreateStatusItem>()); }
public static MergePatchStatusItem ToMergePatchStatusItem(this StatusItemState state) { return(state.ToMergePatchStatusItem <MergePatchStatusItem>()); }
public static DeleteStatusItem ToDeleteStatusItem(this StatusItemState state) { return(state.ToDeleteStatusItem <DeleteStatusItem>()); }
public static IStatusItemCommand ToCreateOrMergePatchStatusItem(this StatusItemState state) { return(state.ToCreateOrMergePatchStatusItem <CreateStatusItem, MergePatchStatusItem>()); }