public virtual void Initialize(ILocatorStateCreated stateCreated)
        {
            var aggregateId = stateCreated.LocatorEventId.LocatorId;
            var state       = new LocatorState();

            state.LocatorId = aggregateId;
            var aggregate = (LocatorAggregate)GetLocatorAggregate(state);

            var eventStoreAggregateId = ToEventStoreAggregateId(aggregateId);

            aggregate.Apply(stateCreated);
            Persist(eventStoreAggregateId, aggregate, state);
        }
Example #2
0
        public virtual ILocatorState ToLocatorState()
        {
            var state = new LocatorState(true);

            state.LocatorId       = this.LocatorId;
            state.WarehouseId     = this.WarehouseId;
            state.ParentLocatorId = this.ParentLocatorId;
            state.LocatorType     = this.LocatorType;
            state.PriorityNumber  = this.PriorityNumber;
            if (this.IsDefault != null && this.IsDefault.HasValue)
            {
                state.IsDefault = this.IsDefault.Value;
            }
            state.X             = this.X;
            state.Y             = this.Y;
            state.Z             = this.Z;
            state.Description   = this.Description;
            state.LocatorTypeId = this.LocatorTypeId;
            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);
        }
Example #3
0
 public static CreateLocator ToCreateLocator(this LocatorState state)
 {
     return(state.ToCreateLocator <CreateLocator>());
 }
Example #4
0
 public static MergePatchLocator ToMergePatchLocator(this LocatorState state)
 {
     return(state.ToMergePatchLocator <MergePatchLocator>());
 }
Example #5
0
 public static DeleteLocator ToDeleteLocator(this LocatorState state)
 {
     return(state.ToDeleteLocator <DeleteLocator>());
 }
Example #6
0
 public static ILocatorCommand ToCreateOrMergePatchLocator(this LocatorState state)
 {
     return(state.ToCreateOrMergePatchLocator <CreateLocator, MergePatchLocator>());
 }