Ejemplo n.º 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);
        }
Ejemplo n.º 3
0
 public static CreateMovementType ToCreateMovementType(this MovementTypeState state)
 {
     return(state.ToCreateMovementType <CreateMovementType>());
 }
Ejemplo n.º 4
0
 public static MergePatchMovementType ToMergePatchMovementType(this MovementTypeState state)
 {
     return(state.ToMergePatchMovementType <MergePatchMovementType>());
 }
Ejemplo n.º 5
0
 public static DeleteMovementType ToDeleteMovementType(this MovementTypeState state)
 {
     return(state.ToDeleteMovementType <DeleteMovementType>());
 }
Ejemplo n.º 6
0
 public static IMovementTypeCommand ToCreateOrMergePatchMovementType(this MovementTypeState state)
 {
     return(state.ToCreateOrMergePatchMovementType <CreateMovementType, MergePatchMovementType>());
 }