Пример #1
0
        public virtual void When(IPartyRoleStateCreated e)
        {
            ThrowOnWrongEvent(e);
            this.Active = (e.Active != null && e.Active.HasValue) ? e.Active.Value : default(bool);

            this.Deleted = false;

            this.CreatedBy = e.CreatedBy;
            this.CreatedAt = e.CreatedAt;
        }
Пример #2
0
        public virtual PartyRoleStateCreatedDto ToPartyRoleStateCreatedDto(IPartyRoleStateCreated e)
        {
            var dto = new PartyRoleStateCreatedDto();

            dto.PartyRoleEventId = e.PartyRoleEventId;
            dto.CreatedAt        = e.CreatedAt;
            dto.CreatedBy        = e.CreatedBy;
            dto.CommandId        = e.CommandId;
            dto.Active           = e.Active;
            return(dto);
        }
Пример #3
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);
        }
Пример #4
0
        protected virtual IPartyRoleStateCreated Map(ICreatePartyRole c)
        {
            var stateEventId         = new PartyRoleEventId(c.PartyRoleId, c.Version);
            IPartyRoleStateCreated e = NewPartyRoleStateCreated(stateEventId);

            e.Active    = c.Active;
            e.CommandId = c.CommandId;


            e.CreatedBy = (string)c.RequesterId;
            e.CreatedAt = ApplicationContext.Current.TimestampService.Now <DateTime>();
            var version = c.Version;


            return(e);
        }
Пример #5
0
        public virtual void Create(ICreatePartyRole c)
        {
            IPartyRoleStateCreated e = Map(c);

            Apply(e);
        }
Пример #6
0
 void IPartyRoleState.When(IPartyRoleStateCreated e)
 {
     throw new NotSupportedException();
 }