public virtual void When(IRejectionReasonStateCreated e) { ThrowOnWrongEvent(e); this.Description = e.Description; this.Active = (e.Active != null && e.Active.HasValue) ? e.Active.Value : default(bool); this.Deleted = false; this.CreatedBy = e.CreatedBy; this.CreatedAt = e.CreatedAt; }
public virtual void Initialize(IRejectionReasonStateCreated stateCreated) { var aggregateId = stateCreated.RejectionReasonEventId.RejectionReasonId; var state = new RejectionReasonState(); state.RejectionReasonId = aggregateId; var aggregate = (RejectionReasonAggregate)GetRejectionReasonAggregate(state); var eventStoreAggregateId = ToEventStoreAggregateId(aggregateId); aggregate.Apply(stateCreated); Persist(eventStoreAggregateId, aggregate, state); }
protected virtual IRejectionReasonStateCreated Map(ICreateRejectionReason c) { var stateEventId = new RejectionReasonEventId(c.RejectionReasonId, c.Version); IRejectionReasonStateCreated e = NewRejectionReasonStateCreated(stateEventId); 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); }
public virtual void Create(ICreateRejectionReason c) { IRejectionReasonStateCreated e = Map(c); Apply(e); }
public virtual RejectionReasonStateCreatedDto ToRejectionReasonStateCreatedDto(IRejectionReasonStateCreated e) { var dto = new RejectionReasonStateCreatedDto(); dto.RejectionReasonEventId = e.RejectionReasonEventId; dto.CreatedAt = e.CreatedAt; dto.CreatedBy = e.CreatedBy; dto.CommandId = e.CommandId; dto.Description = e.Description; dto.Active = e.Active; return(dto); }
void IRejectionReasonState.When(IRejectionReasonStateCreated e) { throw new NotSupportedException(); }