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 virtual StatusItemStateCreatedDto ToStatusItemStateCreatedDto(IStatusItemStateCreated e) { var dto = new StatusItemStateCreatedDto(); dto.StatusItemEventId = e.StatusItemEventId; dto.CreatedAt = e.CreatedAt; dto.CreatedBy = e.CreatedBy; dto.CommandId = e.CommandId; dto.StatusTypeId = e.StatusTypeId; dto.StatusCode = e.StatusCode; dto.SequenceId = e.SequenceId; dto.Description = e.Description; dto.Active = e.Active; return(dto); }
public virtual void When(IStatusItemStateCreated e) { ThrowOnWrongEvent(e); this.StatusTypeId = e.StatusTypeId; this.StatusCode = e.StatusCode; this.SequenceId = e.SequenceId; this.Description = e.Description; this.Active = (e.Active != null && e.Active.HasValue) ? e.Active.Value : default(bool); this.CreatedBy = e.CreatedBy; this.CreatedAt = e.CreatedAt; }
protected virtual IStatusItemStateCreated Map(ICreateStatusItem c) { var stateEventId = new StatusItemEventId(c.StatusId, c.Version); IStatusItemStateCreated e = NewStatusItemStateCreated(stateEventId); e.StatusTypeId = c.StatusTypeId; e.StatusCode = c.StatusCode; e.SequenceId = c.SequenceId; e.Description = c.Description; e.Active = c.Active; e.CommandId = c.CommandId; e.CreatedBy = (string)c.RequesterId; e.CreatedAt = ApplicationContext.Current.TimestampService.Now <DateTime>(); var version = c.Version; return(e); }
void IStatusItemState.When(IStatusItemStateCreated e) { throw new NotSupportedException(); }
public virtual void Create(ICreateStatusItem c) { IStatusItemStateCreated e = Map(c); Apply(e); }