public static TDeleteShipmentType ToDeleteShipmentType <TDeleteShipmentType>(this IShipmentTypeState state) where TDeleteShipmentType : IDeleteShipmentType, new() { var cmd = new TDeleteShipmentType(); cmd.ShipmentTypeId = state.ShipmentTypeId; cmd.Version = ((IShipmentTypeStateProperties)state).Version; return(cmd); }
public IShipmentTypeState Get(string id, bool nullAllowed) { IShipmentTypeState state = CurrentSession.Get <ShipmentTypeState> (id); if (!nullAllowed && state == null) { state = new ShipmentTypeState(); (state as ShipmentTypeState).ShipmentTypeId = id; } return(state); }
public void Save(IShipmentTypeState state) { IShipmentTypeState s = state; CurrentSession.SaveOrUpdate(s); var saveable = s as ISaveable; if (saveable != null) { saveable.Save(); } CurrentSession.Flush(); }
public static TCreateShipmentType ToCreateShipmentType <TCreateShipmentType>(this IShipmentTypeState state) where TCreateShipmentType : ICreateShipmentType, new() { var cmd = new TCreateShipmentType(); cmd.Version = ((IShipmentTypeStateProperties)state).Version; cmd.ShipmentTypeId = state.ShipmentTypeId; cmd.ParentTypeId = state.ParentTypeId; cmd.HasTable = state.HasTable; cmd.Description = state.Description; cmd.Active = ((IShipmentTypeStateProperties)state).Active; return(cmd); }
public async Task <IShipmentTypeState> GetAsync(string shipmentTypeId) { IShipmentTypeState state = null; var idObj = shipmentTypeId; var uriParameters = new ShipmentTypeUriParameters(); uriParameters.Id = idObj; var req = new ShipmentTypeGetRequest(uriParameters); var resp = await _ramlClient.ShipmentType.Get(req); ShipmentTypeProxyUtils.ThrowOnHttpResponseError(resp); state = (resp.Content == null) ? null : resp.Content.ToShipmentTypeState(); return(state); }
public IShipmentTypeState Get(string id) { IShipmentTypeState state = CurrentSession.Get <ShipmentTypeState>(id); return(state); }
protected bool IsRepeatedCommand(IShipmentTypeCommand command, IEventStoreAggregateId eventStoreAggregateId, IShipmentTypeState state) { bool repeated = false; if (((IShipmentTypeStateProperties)state).Version == command.AggregateVersion + 1) { if (state.CommandId == command.CommandId) { repeated = true; } } return(repeated); }
private void Persist(IEventStoreAggregateId eventStoreAggregateId, IShipmentTypeAggregate aggregate, IShipmentTypeState state) { StateRepository.Save(state); if (AggregateEventListener != null) { AggregateEventListener.EventAppended(new AggregateEvent <IShipmentTypeAggregate, IShipmentTypeState>(aggregate, state, aggregate.Changes)); } }
public abstract IShipmentTypeAggregate GetShipmentTypeAggregate(IShipmentTypeState state);
public ShipmentTypeStateDtoWrapper(IShipmentTypeState state) { this._state = state; }
public ShipmentTypeStateDtoWrapper() { this._state = new ShipmentTypeState(); }
public ShipmentTypeAggregate(IShipmentTypeState state) { _state = state; }
public static TMergePatchShipmentType ToMergePatchShipmentType <TMergePatchShipmentType>(this IShipmentTypeState state) where TMergePatchShipmentType : IMergePatchShipmentType, new() { var cmd = new TMergePatchShipmentType(); cmd.Version = ((IShipmentTypeStateProperties)state).Version; cmd.ShipmentTypeId = state.ShipmentTypeId; cmd.ParentTypeId = state.ParentTypeId; cmd.HasTable = state.HasTable; cmd.Description = state.Description; cmd.Active = ((IShipmentTypeStateProperties)state).Active; if (state.ParentTypeId == null) { cmd.IsPropertyParentTypeIdRemoved = true; } if (state.HasTable == null) { cmd.IsPropertyHasTableRemoved = true; } if (state.Description == null) { cmd.IsPropertyDescriptionRemoved = true; } return(cmd); }
public static IShipmentTypeCommand ToCreateOrMergePatchShipmentType <TCreateShipmentType, TMergePatchShipmentType>(this IShipmentTypeState state) where TCreateShipmentType : ICreateShipmentType, new() where TMergePatchShipmentType : IMergePatchShipmentType, new() { bool bUnsaved = ((IShipmentTypeState)state).IsUnsaved; if (bUnsaved) { return(state.ToCreateShipmentType <TCreateShipmentType>()); } else { return(state.ToMergePatchShipmentType <TMergePatchShipmentType>()); } }
public override IShipmentTypeAggregate GetShipmentTypeAggregate(IShipmentTypeState state) { return(new ShipmentTypeAggregate(state)); }