Exemplo n.º 1
0
        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);
        }
Exemplo n.º 2
0
        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);
        }
Exemplo n.º 3
0
 public static CreatePartyRole ToCreatePartyRole(this PartyRoleState state)
 {
     return(state.ToCreatePartyRole <CreatePartyRole>());
 }
Exemplo n.º 4
0
 public static MergePatchPartyRole ToMergePatchPartyRole(this PartyRoleState state)
 {
     return(state.ToMergePatchPartyRole <MergePatchPartyRole>());
 }
Exemplo n.º 5
0
 public static DeletePartyRole ToDeletePartyRole(this PartyRoleState state)
 {
     return(state.ToDeletePartyRole <DeletePartyRole>());
 }
Exemplo n.º 6
0
 public static IPartyRoleCommand ToCreateOrMergePatchPartyRole(this PartyRoleState state)
 {
     return(state.ToCreateOrMergePatchPartyRole <CreatePartyRole, MergePatchPartyRole>());
 }