public virtual void Initialize(IRoleTypeStateCreated stateCreated) { var aggregateId = stateCreated.RoleTypeEventId.RoleTypeId; var state = new RoleTypeState(); state.RoleTypeId = aggregateId; var aggregate = (RoleTypeAggregate)GetRoleTypeAggregate(state); var eventStoreAggregateId = ToEventStoreAggregateId(aggregateId); aggregate.Apply(stateCreated); Persist(eventStoreAggregateId, aggregate, state); }
public virtual RoleTypeStateCreatedDto ToRoleTypeStateCreatedDto(IRoleTypeStateCreated e) { var dto = new RoleTypeStateCreatedDto(); dto.RoleTypeEventId = e.RoleTypeEventId; 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(IRoleTypeStateCreated 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 IRoleTypeStateCreated Map(ICreateRoleType c) { var stateEventId = new RoleTypeEventId(c.RoleTypeId, c.Version); IRoleTypeStateCreated e = NewRoleTypeStateCreated(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 IRoleTypeState.When(IRoleTypeStateCreated e) { throw new NotSupportedException(); }
public virtual void Create(ICreateRoleType c) { IRoleTypeStateCreated e = Map(c); Apply(e); }