public IMovementConfirmationLineMvoState Get(MovementConfirmationLineId id) { IMovementConfirmationLineMvoState state = CurrentSession.Get <MovementConfirmationLineMvoState>(id); if (ReadOnlyProxyGenerator != null && state != null) { return(ReadOnlyProxyGenerator.CreateProxy <IMovementConfirmationLineMvoState>(state, new Type[] { }, _readOnlyPropertyNames)); } return(state); }
public IMovementConfirmationLineMvoState Get(MovementConfirmationLineId id, bool nullAllowed) { IMovementConfirmationLineMvoState state = CurrentSession.Get <MovementConfirmationLineMvoState> (id); if (!nullAllowed && state == null) { state = new MovementConfirmationLineMvoState(); (state as MovementConfirmationLineMvoState).MovementConfirmationLineId = id; } if (ReadOnlyProxyGenerator != null && state != null) { return(ReadOnlyProxyGenerator.CreateProxy <IMovementConfirmationLineMvoState>(state, new Type[] { }, _readOnlyPropertyNames)); } return(state); }
public async Task <IMovementConfirmationLineMvoState> GetAsync(MovementConfirmationLineId movementConfirmationLineId) { IMovementConfirmationLineMvoState state = null; var idObj = MovementConfirmationLineMvoProxyUtils.ToIdString(movementConfirmationLineId); var uriParameters = new MovementConfirmationLineMvoUriParameters(); uriParameters.Id = idObj; var req = new MovementConfirmationLineMvoGetRequest(uriParameters); var resp = await _ramlClient.MovementConfirmationLineMvo.Get(req); MovementConfirmationLineMvoProxyUtils.ThrowOnHttpResponseError(resp); state = (resp.Content == null) ? null : resp.Content.ToMovementConfirmationLineMvoState(); return(state); }
public void Save(IMovementConfirmationLineMvoState state) { IMovementConfirmationLineMvoState s = state; if (ReadOnlyProxyGenerator != null) { s = ReadOnlyProxyGenerator.GetTarget <IMovementConfirmationLineMvoState>(state); } CurrentSession.SaveOrUpdate(s); var saveable = s as ISaveable; if (saveable != null) { saveable.Save(); } CurrentSession.Flush(); }
public MovementConfirmationLineMvoAggregate(IMovementConfirmationLineMvoState state) { _state = state; }
public MovementConfirmationLineMvoStateDtoWrapper(IMovementConfirmationLineMvoState state) { this._state = state; }
public MovementConfirmationLineMvoStateDtoWrapper() { this._state = new MovementConfirmationLineMvoState(); }
public static TMergePatchMovementConfirmationLineMvo ToMergePatchMovementConfirmationLineMvo <TMergePatchMovementConfirmationLineMvo>(this IMovementConfirmationLineMvoState state) where TMergePatchMovementConfirmationLineMvo : IMergePatchMovementConfirmationLineMvo, new() { var cmd = new TMergePatchMovementConfirmationLineMvo(); cmd.MovementConfirmationVersion = ((IMovementConfirmationLineMvoStateProperties)state).MovementConfirmationVersion; cmd.MovementConfirmationLineId = state.MovementConfirmationLineId; cmd.MovementLineNumber = state.MovementLineNumber; cmd.TargetQuantity = state.TargetQuantity; cmd.ConfirmedQuantity = state.ConfirmedQuantity; cmd.DifferenceQuantity = state.DifferenceQuantity; cmd.ScrappedQuantity = state.ScrappedQuantity; cmd.Description = state.Description; cmd.Processed = state.Processed; cmd.Version = ((IMovementConfirmationLineMvoStateProperties)state).Version; cmd.Active = ((IMovementConfirmationLineMvoStateProperties)state).Active; cmd.MovementConfirmationDocumentStatusId = state.MovementConfirmationDocumentStatusId; cmd.MovementConfirmationMovementDocumentNumber = state.MovementConfirmationMovementDocumentNumber; cmd.MovementConfirmationIsApproved = state.MovementConfirmationIsApproved; cmd.MovementConfirmationApprovalAmount = state.MovementConfirmationApprovalAmount; cmd.MovementConfirmationProcessed = state.MovementConfirmationProcessed; cmd.MovementConfirmationProcessing = state.MovementConfirmationProcessing; cmd.MovementConfirmationDocumentTypeId = state.MovementConfirmationDocumentTypeId; cmd.MovementConfirmationDescription = state.MovementConfirmationDescription; cmd.MovementConfirmationCreatedBy = state.MovementConfirmationCreatedBy; cmd.MovementConfirmationCreatedAt = state.MovementConfirmationCreatedAt; cmd.MovementConfirmationUpdatedBy = state.MovementConfirmationUpdatedBy; cmd.MovementConfirmationUpdatedAt = state.MovementConfirmationUpdatedAt; cmd.MovementConfirmationActive = state.MovementConfirmationActive; cmd.MovementConfirmationDeleted = state.MovementConfirmationDeleted; if (state.MovementLineNumber == null) { cmd.IsPropertyMovementLineNumberRemoved = true; } if (state.Description == null) { cmd.IsPropertyDescriptionRemoved = true; } if (state.MovementConfirmationDocumentStatusId == null) { cmd.IsPropertyMovementConfirmationDocumentStatusIdRemoved = true; } if (state.MovementConfirmationMovementDocumentNumber == null) { cmd.IsPropertyMovementConfirmationMovementDocumentNumberRemoved = true; } if (state.MovementConfirmationProcessing == null) { cmd.IsPropertyMovementConfirmationProcessingRemoved = true; } if (state.MovementConfirmationDocumentTypeId == null) { cmd.IsPropertyMovementConfirmationDocumentTypeIdRemoved = true; } if (state.MovementConfirmationDescription == null) { cmd.IsPropertyMovementConfirmationDescriptionRemoved = true; } if (state.MovementConfirmationCreatedBy == null) { cmd.IsPropertyMovementConfirmationCreatedByRemoved = true; } if (state.MovementConfirmationUpdatedBy == null) { cmd.IsPropertyMovementConfirmationUpdatedByRemoved = true; } return(cmd); }
public static TDeleteMovementConfirmationLineMvo ToDeleteMovementConfirmationLineMvo <TDeleteMovementConfirmationLineMvo>(this IMovementConfirmationLineMvoState state) where TDeleteMovementConfirmationLineMvo : IDeleteMovementConfirmationLineMvo, new() { var cmd = new TDeleteMovementConfirmationLineMvo(); cmd.MovementConfirmationLineId = state.MovementConfirmationLineId; cmd.MovementConfirmationVersion = ((IMovementConfirmationLineMvoStateProperties)state).MovementConfirmationVersion; return(cmd); }
public static IMovementConfirmationLineMvoCommand ToCreateOrMergePatchMovementConfirmationLineMvo <TCreateMovementConfirmationLineMvo, TMergePatchMovementConfirmationLineMvo>(this IMovementConfirmationLineMvoState state) where TCreateMovementConfirmationLineMvo : ICreateMovementConfirmationLineMvo, new() where TMergePatchMovementConfirmationLineMvo : IMergePatchMovementConfirmationLineMvo, new() { bool bUnsaved = ((IMovementConfirmationLineMvoState)state).IsUnsaved; if (bUnsaved) { return(state.ToCreateMovementConfirmationLineMvo <TCreateMovementConfirmationLineMvo>()); } else { return(state.ToMergePatchMovementConfirmationLineMvo <TMergePatchMovementConfirmationLineMvo>()); } }
public static TCreateMovementConfirmationLineMvo ToCreateMovementConfirmationLineMvo <TCreateMovementConfirmationLineMvo>(this IMovementConfirmationLineMvoState state) where TCreateMovementConfirmationLineMvo : ICreateMovementConfirmationLineMvo, new() { var cmd = new TCreateMovementConfirmationLineMvo(); cmd.MovementConfirmationVersion = ((IMovementConfirmationLineMvoStateProperties)state).MovementConfirmationVersion; cmd.MovementConfirmationLineId = state.MovementConfirmationLineId; cmd.MovementLineNumber = state.MovementLineNumber; cmd.TargetQuantity = state.TargetQuantity; cmd.ConfirmedQuantity = state.ConfirmedQuantity; cmd.DifferenceQuantity = state.DifferenceQuantity; cmd.ScrappedQuantity = state.ScrappedQuantity; cmd.Description = state.Description; cmd.Processed = state.Processed; cmd.Version = ((IMovementConfirmationLineMvoStateProperties)state).Version; cmd.Active = ((IMovementConfirmationLineMvoStateProperties)state).Active; cmd.MovementConfirmationDocumentStatusId = state.MovementConfirmationDocumentStatusId; cmd.MovementConfirmationMovementDocumentNumber = state.MovementConfirmationMovementDocumentNumber; cmd.MovementConfirmationIsApproved = state.MovementConfirmationIsApproved; cmd.MovementConfirmationApprovalAmount = state.MovementConfirmationApprovalAmount; cmd.MovementConfirmationProcessed = state.MovementConfirmationProcessed; cmd.MovementConfirmationProcessing = state.MovementConfirmationProcessing; cmd.MovementConfirmationDocumentTypeId = state.MovementConfirmationDocumentTypeId; cmd.MovementConfirmationDescription = state.MovementConfirmationDescription; cmd.MovementConfirmationCreatedBy = state.MovementConfirmationCreatedBy; cmd.MovementConfirmationCreatedAt = state.MovementConfirmationCreatedAt; cmd.MovementConfirmationUpdatedBy = state.MovementConfirmationUpdatedBy; cmd.MovementConfirmationUpdatedAt = state.MovementConfirmationUpdatedAt; cmd.MovementConfirmationActive = state.MovementConfirmationActive; cmd.MovementConfirmationDeleted = state.MovementConfirmationDeleted; return(cmd); }
public override IMovementConfirmationLineMvoAggregate GetMovementConfirmationLineMvoAggregate(IMovementConfirmationLineMvoState state) { return(new MovementConfirmationLineMvoAggregate(state)); }
protected bool IsRepeatedCommand(IMovementConfirmationLineMvoCommand command, IEventStoreAggregateId eventStoreAggregateId, IMovementConfirmationLineMvoState state) { bool repeated = false; if (((IMovementConfirmationLineMvoStateProperties)state).MovementConfirmationVersion > command.AggregateVersion) { var lastEvent = EventStore.GetEvent(typeof(IMovementConfirmationLineMvoEvent), eventStoreAggregateId, command.AggregateVersion); if (lastEvent != null && lastEvent.CommandId == command.CommandId) { repeated = true; } } return(repeated); }
private void Persist(IEventStoreAggregateId eventStoreAggregateId, IMovementConfirmationLineMvoAggregate aggregate, IMovementConfirmationLineMvoState state) { EventStore.AppendEvents(eventStoreAggregateId, ((IMovementConfirmationLineMvoStateProperties)state).MovementConfirmationVersion, aggregate.Changes, () => { StateRepository.Save(state); }); if (AggregateEventListener != null) { AggregateEventListener.EventAppended(new AggregateEvent <IMovementConfirmationLineMvoAggregate, IMovementConfirmationLineMvoState>(aggregate, state, aggregate.Changes)); } }
public abstract IMovementConfirmationLineMvoAggregate GetMovementConfirmationLineMvoAggregate(IMovementConfirmationLineMvoState state);