public virtual void Initialize(IGoodIdentificationTypeStateCreated stateCreated) { var aggregateId = stateCreated.GoodIdentificationTypeEventId.GoodIdentificationTypeId; var state = new GoodIdentificationTypeState(); state.GoodIdentificationTypeId = aggregateId; var aggregate = (GoodIdentificationTypeAggregate)GetGoodIdentificationTypeAggregate(state); var eventStoreAggregateId = ToEventStoreAggregateId(aggregateId); aggregate.Apply(stateCreated); Persist(eventStoreAggregateId, aggregate, state); }
public virtual void When(IGoodIdentificationTypeStateCreated 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 IGoodIdentificationTypeStateCreated Map(ICreateGoodIdentificationType c) { var stateEventId = new GoodIdentificationTypeEventId(c.GoodIdentificationTypeId, c.Version); IGoodIdentificationTypeStateCreated e = NewGoodIdentificationTypeStateCreated(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 IGoodIdentificationTypeState.When(IGoodIdentificationTypeStateCreated e) { throw new NotSupportedException(); }
public virtual void Create(ICreateGoodIdentificationType c) { IGoodIdentificationTypeStateCreated e = Map(c); Apply(e); }
public virtual GoodIdentificationTypeStateCreatedDto ToGoodIdentificationTypeStateCreatedDto(IGoodIdentificationTypeStateCreated e) { var dto = new GoodIdentificationTypeStateCreatedDto(); dto.GoodIdentificationTypeEventId = e.GoodIdentificationTypeEventId; 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); }