public virtual void Initialize(IFacilityStateCreated stateCreated) { var aggregateId = stateCreated.FacilityEventId.FacilityId; var state = new FacilityState(); state.FacilityId = aggregateId; var aggregate = (FacilityAggregate)GetFacilityAggregate(state); var eventStoreAggregateId = ToEventStoreAggregateId(aggregateId); aggregate.Apply(stateCreated); Persist(eventStoreAggregateId, aggregate, state); }
public virtual IFacilityState ToFacilityState() { var state = new FacilityState(true); state.FacilityId = this.FacilityId; state.FacilityTypeId = this.FacilityTypeId; state.ParentFacilityId = this.ParentFacilityId; state.OwnerPartyId = this.OwnerPartyId; state.DefaultInventoryItemTypeId = this.DefaultInventoryItemTypeId; state.FacilityName = this.FacilityName; state.PrimaryFacilityGroupId = this.PrimaryFacilityGroupId; state.OldSquareFootage = this.OldSquareFootage; state.FacilitySize = this.FacilitySize; state.FacilitySizeUomId = this.FacilitySizeUomId; state.ProductStoreId = this.ProductStoreId; state.DefaultDaysToShip = this.DefaultDaysToShip; state.OpenedDate = this.OpenedDate; state.ClosedDate = this.ClosedDate; state.Description = this.Description; state.DefaultDimensionUomId = this.DefaultDimensionUomId; state.DefaultWeightUomId = this.DefaultWeightUomId; state.GeoPointId = this.GeoPointId; 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 CreateFacility ToCreateFacility(this FacilityState state) { return(state.ToCreateFacility <CreateFacility>()); }
public static MergePatchFacility ToMergePatchFacility(this FacilityState state) { return(state.ToMergePatchFacility <MergePatchFacility>()); }
public static DeleteFacility ToDeleteFacility(this FacilityState state) { return(state.ToDeleteFacility <DeleteFacility>()); }
public static IFacilityCommand ToCreateOrMergePatchFacility(this FacilityState state) { return(state.ToCreateOrMergePatchFacility <CreateFacility, MergePatchFacility>()); }