public virtual IPartyRoleState ToPartyRoleState() { var state = new PartyRoleState(true); state.PartyRoleId = this.PartyRoleId; if (this.Active != null && this.Active.HasValue) { state.Active = this.Active.Value; } if (this.Version != null && this.Version.HasValue) { state.Version = this.Version.Value; } state.CreatedBy = this.CreatedBy; if (this.CreatedAt != null && this.CreatedAt.HasValue) { state.CreatedAt = this.CreatedAt.Value; } state.UpdatedBy = this.UpdatedBy; if (this.UpdatedAt != null && this.UpdatedAt.HasValue) { state.UpdatedAt = this.UpdatedAt.Value; } return(state); }
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); }
public static CreatePartyRole ToCreatePartyRole(this PartyRoleState state) { return(state.ToCreatePartyRole <CreatePartyRole>()); }
public static MergePatchPartyRole ToMergePatchPartyRole(this PartyRoleState state) { return(state.ToMergePatchPartyRole <MergePatchPartyRole>()); }
public static DeletePartyRole ToDeletePartyRole(this PartyRoleState state) { return(state.ToDeletePartyRole <DeletePartyRole>()); }
public static IPartyRoleCommand ToCreateOrMergePatchPartyRole(this PartyRoleState state) { return(state.ToCreateOrMergePatchPartyRole <CreatePartyRole, MergePatchPartyRole>()); }