コード例 #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);
        }
コード例 #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);
        }
コード例 #3
0
 public static CreatePartyRole ToCreatePartyRole(this PartyRoleState state)
 {
     return(state.ToCreatePartyRole <CreatePartyRole>());
 }
コード例 #4
0
 public static MergePatchPartyRole ToMergePatchPartyRole(this PartyRoleState state)
 {
     return(state.ToMergePatchPartyRole <MergePatchPartyRole>());
 }
コード例 #5
0
 public static DeletePartyRole ToDeletePartyRole(this PartyRoleState state)
 {
     return(state.ToDeletePartyRole <DeletePartyRole>());
 }
コード例 #6
0
 public static IPartyRoleCommand ToCreateOrMergePatchPartyRole(this PartyRoleState state)
 {
     return(state.ToCreateOrMergePatchPartyRole <CreatePartyRole, MergePatchPartyRole>());
 }