public virtual void Initialize(IPartyStateCreated stateCreated) { var aggregateId = stateCreated.PartyEventId.PartyId; var state = new PartyState(); state.PartyId = aggregateId; var aggregate = (PartyAggregate)GetPartyAggregate(state); var eventStoreAggregateId = ToEventStoreAggregateId(aggregateId); aggregate.Apply(stateCreated); Persist(eventStoreAggregateId, aggregate, state); }
public virtual IPartyState ToPartyState() { var state = new PartyState(true); state.PartyId = this.PartyId; state.PartyTypeId = this.PartyTypeId; state.PrimaryRoleTypeId = this.PrimaryRoleTypeId; state.ExternalId = this.ExternalId; state.PreferredCurrencyUomId = this.PreferredCurrencyUomId; state.Description = this.Description; state.OrganizationName = this.OrganizationName; if (this.IsSummary != null && this.IsSummary.HasValue) { state.IsSummary = this.IsSummary.Value; } state.Salutation = this.Salutation; state.FirstName = this.FirstName; state.MiddleName = this.MiddleName; state.LastName = this.LastName; state.PersonalTitle = this.PersonalTitle; state.Nickname = this.Nickname; state.CardId = this.CardId; 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 static CreateParty ToCreateParty(this PartyState state) { return(state.ToCreateParty <CreateParty>()); }
public static MergePatchParty ToMergePatchParty(this PartyState state) { return(state.ToMergePatchParty <MergePatchParty>()); }
public static DeleteParty ToDeleteParty(this PartyState state) { return(state.ToDeleteParty <DeleteParty>()); }
public static IPartyCommand ToCreateOrMergePatchParty(this PartyState state) { return(state.ToCreateOrMergePatchParty <CreateParty, MergePatchParty>()); }