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); }
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); }
public static CreateDamageReason ToCreateDamageReason(this DamageReasonState state) { return(state.ToCreateDamageReason <CreateDamageReason>()); }
public static MergePatchDamageReason ToMergePatchDamageReason(this DamageReasonState state) { return(state.ToMergePatchDamageReason <MergePatchDamageReason>()); }
public static DeleteDamageReason ToDeleteDamageReason(this DamageReasonState state) { return(state.ToDeleteDamageReason <DeleteDamageReason>()); }
public static IDamageReasonCommand ToCreateOrMergePatchDamageReason(this DamageReasonState state) { return(state.ToCreateOrMergePatchDamageReason <CreateDamageReason, MergePatchDamageReason>()); }