Esempio n. 1
0
        public virtual IDamageTypeState ToDamageTypeState()
        {
            var state = new DamageTypeState(true);

            state.DamageTypeId            = this.DamageTypeId;
            state.Description             = this.Description;
            state.SequenceId              = this.SequenceId;
            state.DefaultHandlingMethodId = this.DefaultHandlingMethodId;
            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);
        }
Esempio n. 2
0
        public virtual void Initialize(IDamageTypeStateCreated stateCreated)
        {
            var aggregateId = stateCreated.DamageTypeEventId.DamageTypeId;
            var state       = new DamageTypeState();

            state.DamageTypeId = aggregateId;
            var aggregate = (DamageTypeAggregate)GetDamageTypeAggregate(state);

            var eventStoreAggregateId = ToEventStoreAggregateId(aggregateId);

            aggregate.Apply(stateCreated);
            Persist(eventStoreAggregateId, aggregate, state);
        }
Esempio n. 3
0
 public static CreateDamageType ToCreateDamageType(this DamageTypeState state)
 {
     return(state.ToCreateDamageType <CreateDamageType>());
 }
Esempio n. 4
0
 public static MergePatchDamageType ToMergePatchDamageType(this DamageTypeState state)
 {
     return(state.ToMergePatchDamageType <MergePatchDamageType>());
 }
Esempio n. 5
0
 public static DeleteDamageType ToDeleteDamageType(this DamageTypeState state)
 {
     return(state.ToDeleteDamageType <DeleteDamageType>());
 }
Esempio n. 6
0
 public static IDamageTypeCommand ToCreateOrMergePatchDamageType(this DamageTypeState state)
 {
     return(state.ToCreateOrMergePatchDamageType <CreateDamageType, MergePatchDamageType>());
 }