public virtual void Initialize(IUomTypeStateCreated stateCreated) { var aggregateId = stateCreated.UomTypeEventId.UomTypeId; var state = new UomTypeState(); state.UomTypeId = aggregateId; var aggregate = (UomTypeAggregate)GetUomTypeAggregate(state); var eventStoreAggregateId = ToEventStoreAggregateId(aggregateId); aggregate.Apply(stateCreated); Persist(eventStoreAggregateId, aggregate, state); }
public virtual UomTypeStateCreatedDto ToUomTypeStateCreatedDto(IUomTypeStateCreated e) { var dto = new UomTypeStateCreatedDto(); dto.UomTypeEventId = e.UomTypeEventId; dto.CreatedAt = e.CreatedAt; dto.CreatedBy = e.CreatedBy; dto.CommandId = e.CommandId; dto.ParentTypeId = e.ParentTypeId; dto.HasTable = e.HasTable; dto.Description = e.Description; dto.Active = e.Active; return(dto); }
public virtual void When(IUomTypeStateCreated e) { ThrowOnWrongEvent(e); this.ParentTypeId = e.ParentTypeId; this.HasTable = e.HasTable; 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 IUomTypeStateCreated Map(ICreateUomType c) { var stateEventId = new UomTypeEventId(c.UomTypeId, c.Version); IUomTypeStateCreated e = NewUomTypeStateCreated(stateEventId); e.ParentTypeId = c.ParentTypeId; e.HasTable = c.HasTable; 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 IUomTypeState.When(IUomTypeStateCreated e) { throw new NotSupportedException(); }
public virtual void Create(ICreateUomType c) { IUomTypeStateCreated e = Map(c); Apply(e); }