public virtual void When(IPartyRoleStateCreated e) { ThrowOnWrongEvent(e); 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 PartyRoleStateCreatedDto ToPartyRoleStateCreatedDto(IPartyRoleStateCreated e) { var dto = new PartyRoleStateCreatedDto(); dto.PartyRoleEventId = e.PartyRoleEventId; dto.CreatedAt = e.CreatedAt; dto.CreatedBy = e.CreatedBy; dto.CommandId = e.CommandId; dto.Active = e.Active; return(dto); }
public virtual void Initialize(IPartyRoleStateCreated stateCreated) { var aggregateId = stateCreated.PartyRoleEventId.PartyRoleId; var state = new PartyRoleState(); state.PartyRoleId = aggregateId; var aggregate = (PartyRoleAggregate)GetPartyRoleAggregate(state); var eventStoreAggregateId = ToEventStoreAggregateId(aggregateId); aggregate.Apply(stateCreated); Persist(eventStoreAggregateId, aggregate, state); }
protected virtual IPartyRoleStateCreated Map(ICreatePartyRole c) { var stateEventId = new PartyRoleEventId(c.PartyRoleId, c.Version); IPartyRoleStateCreated e = NewPartyRoleStateCreated(stateEventId); 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(ICreatePartyRole c) { IPartyRoleStateCreated e = Map(c); Apply(e); }
void IPartyRoleState.When(IPartyRoleStateCreated e) { throw new NotSupportedException(); }