예제 #1
0
        public virtual void When(IRejectionReasonStateCreated e)
        {
            ThrowOnWrongEvent(e);
            this.Description = e.Description;

            this.Active = (e.Active != null && e.Active.HasValue) ? e.Active.Value : default(bool);

            this.Deleted = false;

            this.CreatedBy = e.CreatedBy;
            this.CreatedAt = e.CreatedAt;
        }
        public virtual void Initialize(IRejectionReasonStateCreated stateCreated)
        {
            var aggregateId = stateCreated.RejectionReasonEventId.RejectionReasonId;
            var state       = new RejectionReasonState();

            state.RejectionReasonId = aggregateId;
            var aggregate = (RejectionReasonAggregate)GetRejectionReasonAggregate(state);

            var eventStoreAggregateId = ToEventStoreAggregateId(aggregateId);

            aggregate.Apply(stateCreated);
            Persist(eventStoreAggregateId, aggregate, state);
        }
예제 #3
0
        protected virtual IRejectionReasonStateCreated Map(ICreateRejectionReason c)
        {
            var stateEventId = new RejectionReasonEventId(c.RejectionReasonId, c.Version);
            IRejectionReasonStateCreated e = NewRejectionReasonStateCreated(stateEventId);

            e.Description = c.Description;
            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);
        }
예제 #4
0
        public virtual void Create(ICreateRejectionReason c)
        {
            IRejectionReasonStateCreated e = Map(c);

            Apply(e);
        }
        public virtual RejectionReasonStateCreatedDto ToRejectionReasonStateCreatedDto(IRejectionReasonStateCreated e)
        {
            var dto = new RejectionReasonStateCreatedDto();

            dto.RejectionReasonEventId = e.RejectionReasonEventId;
            dto.CreatedAt   = e.CreatedAt;
            dto.CreatedBy   = e.CreatedBy;
            dto.CommandId   = e.CommandId;
            dto.Description = e.Description;
            dto.Active      = e.Active;
            return(dto);
        }
예제 #6
0
 void IRejectionReasonState.When(IRejectionReasonStateCreated e)
 {
     throw new NotSupportedException();
 }