Example #1
0
        public virtual IMovementTypeState ToMovementTypeState()
        {
            var state = new MovementTypeState(true);

            state.MovementTypeId = this.MovementTypeId;
            state.Description    = this.Description;
            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(IMovementTypeStateCreated stateCreated)
        {
            var aggregateId = stateCreated.MovementTypeEventId.MovementTypeId;
            var state       = new MovementTypeState();

            state.MovementTypeId = aggregateId;
            var aggregate = (MovementTypeAggregate)GetMovementTypeAggregate(state);

            var eventStoreAggregateId = ToEventStoreAggregateId(aggregateId);

            aggregate.Apply(stateCreated);
            Persist(eventStoreAggregateId, aggregate, state);
        }
Example #3
0
 public static CreateMovementType ToCreateMovementType(this MovementTypeState state)
 {
     return(state.ToCreateMovementType <CreateMovementType>());
 }
Example #4
0
 public static MergePatchMovementType ToMergePatchMovementType(this MovementTypeState state)
 {
     return(state.ToMergePatchMovementType <MergePatchMovementType>());
 }
Example #5
0
 public static DeleteMovementType ToDeleteMovementType(this MovementTypeState state)
 {
     return(state.ToDeleteMovementType <DeleteMovementType>());
 }
Example #6
0
 public static IMovementTypeCommand ToCreateOrMergePatchMovementType(this MovementTypeState state)
 {
     return(state.ToCreateOrMergePatchMovementType <CreateMovementType, MergePatchMovementType>());
 }