Exemple #1
0
        public virtual IDamageReasonState ToDamageReasonState()
        {
            var state = new DamageReasonState(true);

            state.DamageReasonId = this.DamageReasonId;
            state.Description    = this.Description;
            state.SequenceId     = this.SequenceId;
            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);
        }
Exemple #2
0
        public virtual void Initialize(IDamageReasonStateCreated stateCreated)
        {
            var aggregateId = stateCreated.DamageReasonEventId.DamageReasonId;
            var state       = new DamageReasonState();

            state.DamageReasonId = aggregateId;
            var aggregate = (DamageReasonAggregate)GetDamageReasonAggregate(state);

            var eventStoreAggregateId = ToEventStoreAggregateId(aggregateId);

            aggregate.Apply(stateCreated);
            Persist(eventStoreAggregateId, aggregate, state);
        }
Exemple #3
0
 public static CreateDamageReason ToCreateDamageReason(this DamageReasonState state)
 {
     return(state.ToCreateDamageReason <CreateDamageReason>());
 }
Exemple #4
0
 public static MergePatchDamageReason ToMergePatchDamageReason(this DamageReasonState state)
 {
     return(state.ToMergePatchDamageReason <MergePatchDamageReason>());
 }
Exemple #5
0
 public static DeleteDamageReason ToDeleteDamageReason(this DamageReasonState state)
 {
     return(state.ToDeleteDamageReason <DeleteDamageReason>());
 }
Exemple #6
0
 public static IDamageReasonCommand ToCreateOrMergePatchDamageReason(this DamageReasonState state)
 {
     return(state.ToCreateOrMergePatchDamageReason <CreateDamageReason, MergePatchDamageReason>());
 }