Beispiel #1
0
        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);
        }
Beispiel #2
0
        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);
        }
Beispiel #3
0
 public static CreateParty ToCreateParty(this PartyState state)
 {
     return(state.ToCreateParty <CreateParty>());
 }
Beispiel #4
0
 public static MergePatchParty ToMergePatchParty(this PartyState state)
 {
     return(state.ToMergePatchParty <MergePatchParty>());
 }
Beispiel #5
0
 public static DeleteParty ToDeleteParty(this PartyState state)
 {
     return(state.ToDeleteParty <DeleteParty>());
 }
Beispiel #6
0
 public static IPartyCommand ToCreateOrMergePatchParty(this PartyState state)
 {
     return(state.ToCreateOrMergePatchParty <CreateParty, MergePatchParty>());
 }