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); }
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); }
public static CreateLocator ToCreateLocator(this LocatorState state) { return(state.ToCreateLocator <CreateLocator>()); }
public static MergePatchLocator ToMergePatchLocator(this LocatorState state) { return(state.ToMergePatchLocator <MergePatchLocator>()); }
public static DeleteLocator ToDeleteLocator(this LocatorState state) { return(state.ToDeleteLocator <DeleteLocator>()); }
public static ILocatorCommand ToCreateOrMergePatchLocator(this LocatorState state) { return(state.ToCreateOrMergePatchLocator <CreateLocator, MergePatchLocator>()); }