示例#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);
        }
示例#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);
        }
示例#3
0
 public static CreateDamageReason ToCreateDamageReason(this DamageReasonState state)
 {
     return(state.ToCreateDamageReason <CreateDamageReason>());
 }
示例#4
0
 public static MergePatchDamageReason ToMergePatchDamageReason(this DamageReasonState state)
 {
     return(state.ToMergePatchDamageReason <MergePatchDamageReason>());
 }
示例#5
0
 public static DeleteDamageReason ToDeleteDamageReason(this DamageReasonState state)
 {
     return(state.ToDeleteDamageReason <DeleteDamageReason>());
 }
示例#6
0
 public static IDamageReasonCommand ToCreateOrMergePatchDamageReason(this DamageReasonState state)
 {
     return(state.ToCreateOrMergePatchDamageReason <CreateDamageReason, MergePatchDamageReason>());
 }