public static TDeleteStatusItem ToDeleteStatusItem <TDeleteStatusItem>(this IStatusItemState state) where TDeleteStatusItem : IDeleteStatusItem, new() { var cmd = new TDeleteStatusItem(); cmd.StatusId = state.StatusId; cmd.Version = ((IStatusItemStateProperties)state).Version; return(cmd); }
public IStatusItemState Get(string id, bool nullAllowed) { IStatusItemState state = CurrentSession.Get <StatusItemState> (id); if (!nullAllowed && state == null) { state = new StatusItemState(); (state as StatusItemState).StatusId = id; } return(state); }
public void Save(IStatusItemState state) { IStatusItemState s = state; CurrentSession.SaveOrUpdate(s); var saveable = s as ISaveable; if (saveable != null) { saveable.Save(); } CurrentSession.Flush(); }
public static TCreateStatusItem ToCreateStatusItem <TCreateStatusItem>(this IStatusItemState state) where TCreateStatusItem : ICreateStatusItem, new() { var cmd = new TCreateStatusItem(); cmd.Version = ((IStatusItemStateProperties)state).Version; cmd.StatusId = state.StatusId; cmd.StatusTypeId = state.StatusTypeId; cmd.StatusCode = state.StatusCode; cmd.SequenceId = state.SequenceId; cmd.Description = state.Description; cmd.Active = ((IStatusItemStateProperties)state).Active; return(cmd); }
public async Task <IStatusItemState> GetAsync(string statusId) { IStatusItemState state = null; var idObj = statusId; var uriParameters = new StatusItemUriParameters(); uriParameters.Id = idObj; var req = new StatusItemGetRequest(uriParameters); var resp = await _ramlClient.StatusItem.Get(req); StatusItemProxyUtils.ThrowOnHttpResponseError(resp); state = (resp.Content == null) ? null : resp.Content.ToStatusItemState(); return(state); }
public StatusItemStateDtoWrapper(IStatusItemState state) { this._state = state; }
public StatusItemStateDtoWrapper() { this._state = new StatusItemState(); }
public override IStatusItemAggregate GetStatusItemAggregate(IStatusItemState state) { return(new StatusItemAggregate(state)); }
public static TMergePatchStatusItem ToMergePatchStatusItem <TMergePatchStatusItem>(this IStatusItemState state) where TMergePatchStatusItem : IMergePatchStatusItem, new() { var cmd = new TMergePatchStatusItem(); cmd.Version = ((IStatusItemStateProperties)state).Version; cmd.StatusId = state.StatusId; cmd.StatusTypeId = state.StatusTypeId; cmd.StatusCode = state.StatusCode; cmd.SequenceId = state.SequenceId; cmd.Description = state.Description; cmd.Active = ((IStatusItemStateProperties)state).Active; if (state.StatusTypeId == null) { cmd.IsPropertyStatusTypeIdRemoved = true; } if (state.StatusCode == null) { cmd.IsPropertyStatusCodeRemoved = true; } if (state.SequenceId == null) { cmd.IsPropertySequenceIdRemoved = true; } if (state.Description == null) { cmd.IsPropertyDescriptionRemoved = true; } return(cmd); }
public static IStatusItemCommand ToCreateOrMergePatchStatusItem <TCreateStatusItem, TMergePatchStatusItem>(this IStatusItemState state) where TCreateStatusItem : ICreateStatusItem, new() where TMergePatchStatusItem : IMergePatchStatusItem, new() { bool bUnsaved = ((IStatusItemState)state).IsUnsaved; if (bUnsaved) { return(state.ToCreateStatusItem <TCreateStatusItem>()); } else { return(state.ToMergePatchStatusItem <TMergePatchStatusItem>()); } }
protected bool IsRepeatedCommand(IStatusItemCommand command, IEventStoreAggregateId eventStoreAggregateId, IStatusItemState state) { bool repeated = false; if (((IStatusItemStateProperties)state).Version == command.AggregateVersion + 1) { if (state.CommandId == command.CommandId) { repeated = true; } } return(repeated); }
private void Persist(IEventStoreAggregateId eventStoreAggregateId, IStatusItemAggregate aggregate, IStatusItemState state) { StateRepository.Save(state); if (AggregateEventListener != null) { AggregateEventListener.EventAppended(new AggregateEvent <IStatusItemAggregate, IStatusItemState>(aggregate, state, aggregate.Changes)); } }
public abstract IStatusItemAggregate GetStatusItemAggregate(IStatusItemState state);
public IStatusItemState Get(string id) { IStatusItemState state = CurrentSession.Get <StatusItemState>(id); return(state); }
public StatusItemAggregate(IStatusItemState state) { _state = state; }