public virtual void Initialize(IUomStateCreated stateCreated) { var aggregateId = stateCreated.UomEventId.UomId; var state = new UomState(); state.UomId = aggregateId; var aggregate = (UomAggregate)GetUomAggregate(state); var eventStoreAggregateId = ToEventStoreAggregateId(aggregateId); aggregate.Apply(stateCreated); Persist(eventStoreAggregateId, aggregate, state); }
public virtual UomStateCreatedDto ToUomStateCreatedDto(IUomStateCreated e) { var dto = new UomStateCreatedDto(); dto.UomEventId = e.UomEventId; dto.CreatedAt = e.CreatedAt; dto.CreatedBy = e.CreatedBy; dto.CommandId = e.CommandId; dto.UomTypeId = e.UomTypeId; dto.Abbreviation = e.Abbreviation; dto.Description = e.Description; dto.Active = e.Active; return(dto); }
public virtual void When(IUomStateCreated e) { ThrowOnWrongEvent(e); this.UomTypeId = e.UomTypeId; this.Abbreviation = e.Abbreviation; 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; }
protected virtual IUomStateCreated Map(ICreateUom c) { var stateEventId = new UomEventId(c.UomId, c.Version); IUomStateCreated e = NewUomStateCreated(stateEventId); e.UomTypeId = c.UomTypeId; e.Abbreviation = c.Abbreviation; 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(ICreateUom c) { IUomStateCreated e = Map(c); Apply(e); }
void IUomState.When(IUomStateCreated e) { throw new NotSupportedException(); }