public IShipmentMethodTypeState Get(string id) { IShipmentMethodTypeState state = CurrentSession.Get <ShipmentMethodTypeState>(id); if (ReadOnlyProxyGenerator != null && state != null) { return(ReadOnlyProxyGenerator.CreateProxy <IShipmentMethodTypeState>(state, new Type[] { }, _readOnlyPropertyNames)); } return(state); }
public IShipmentMethodTypeState Get(string id, bool nullAllowed) { IShipmentMethodTypeState state = CurrentSession.Get <ShipmentMethodTypeState> (id); if (!nullAllowed && state == null) { state = new ShipmentMethodTypeState(); (state as ShipmentMethodTypeState).ShipmentMethodTypeId = id; } if (ReadOnlyProxyGenerator != null && state != null) { return(ReadOnlyProxyGenerator.CreateProxy <IShipmentMethodTypeState>(state, new Type[] { }, _readOnlyPropertyNames)); } return(state); }
public async Task <IShipmentMethodTypeState> GetAsync(string shipmentMethodTypeId) { IShipmentMethodTypeState state = null; var idObj = shipmentMethodTypeId; var uriParameters = new ShipmentMethodTypeUriParameters(); uriParameters.Id = idObj; var req = new ShipmentMethodTypeGetRequest(uriParameters); var resp = await _ramlClient.ShipmentMethodType.Get(req); ShipmentMethodTypeProxyUtils.ThrowOnHttpResponseError(resp); state = (resp.Content == null) ? null : resp.Content.ToShipmentMethodTypeState(); return(state); }
public void Save(IShipmentMethodTypeState state) { IShipmentMethodTypeState s = state; if (ReadOnlyProxyGenerator != null) { s = ReadOnlyProxyGenerator.GetTarget <IShipmentMethodTypeState>(state); } CurrentSession.SaveOrUpdate(s); var saveable = s as ISaveable; if (saveable != null) { saveable.Save(); } CurrentSession.Flush(); }
public override IShipmentMethodTypeAggregate GetShipmentMethodTypeAggregate(IShipmentMethodTypeState state) { return(new ShipmentMethodTypeAggregate(state)); }
public ShipmentMethodTypeAggregate(IShipmentMethodTypeState state) { _state = state; }
protected bool IsRepeatedCommand(IShipmentMethodTypeCommand command, IEventStoreAggregateId eventStoreAggregateId, IShipmentMethodTypeState state) { bool repeated = false; if (((IShipmentMethodTypeStateProperties)state).Version > command.AggregateVersion) { var lastEvent = EventStore.GetEvent(typeof(IShipmentMethodTypeEvent), eventStoreAggregateId, command.AggregateVersion); if (lastEvent != null && lastEvent.CommandId == command.CommandId) { repeated = true; } } return(repeated); }
private void Persist(IEventStoreAggregateId eventStoreAggregateId, IShipmentMethodTypeAggregate aggregate, IShipmentMethodTypeState state) { EventStore.AppendEvents(eventStoreAggregateId, ((IShipmentMethodTypeStateProperties)state).Version, aggregate.Changes, () => { StateRepository.Save(state); }); if (AggregateEventListener != null) { AggregateEventListener.EventAppended(new AggregateEvent <IShipmentMethodTypeAggregate, IShipmentMethodTypeState>(aggregate, state, aggregate.Changes)); } }
public abstract IShipmentMethodTypeAggregate GetShipmentMethodTypeAggregate(IShipmentMethodTypeState state);
public static TCreateShipmentMethodType ToCreateShipmentMethodType <TCreateShipmentMethodType>(this IShipmentMethodTypeState state) where TCreateShipmentMethodType : ICreateShipmentMethodType, new() { var cmd = new TCreateShipmentMethodType(); cmd.Version = ((IShipmentMethodTypeStateProperties)state).Version; cmd.ShipmentMethodTypeId = state.ShipmentMethodTypeId; cmd.Description = state.Description; cmd.SequenceNum = state.SequenceNum; cmd.Active = ((IShipmentMethodTypeStateProperties)state).Active; return(cmd); }
public static TMergePatchShipmentMethodType ToMergePatchShipmentMethodType <TMergePatchShipmentMethodType>(this IShipmentMethodTypeState state) where TMergePatchShipmentMethodType : IMergePatchShipmentMethodType, new() { var cmd = new TMergePatchShipmentMethodType(); cmd.Version = ((IShipmentMethodTypeStateProperties)state).Version; cmd.ShipmentMethodTypeId = state.ShipmentMethodTypeId; cmd.Description = state.Description; cmd.SequenceNum = state.SequenceNum; cmd.Active = ((IShipmentMethodTypeStateProperties)state).Active; if (state.Description == null) { cmd.IsPropertyDescriptionRemoved = true; } if (state.SequenceNum == null) { cmd.IsPropertySequenceNumRemoved = true; } return(cmd); }
public static TDeleteShipmentMethodType ToDeleteShipmentMethodType <TDeleteShipmentMethodType>(this IShipmentMethodTypeState state) where TDeleteShipmentMethodType : IDeleteShipmentMethodType, new() { var cmd = new TDeleteShipmentMethodType(); cmd.ShipmentMethodTypeId = state.ShipmentMethodTypeId; cmd.Version = ((IShipmentMethodTypeStateProperties)state).Version; return(cmd); }
public static IShipmentMethodTypeCommand ToCreateOrMergePatchShipmentMethodType <TCreateShipmentMethodType, TMergePatchShipmentMethodType>(this IShipmentMethodTypeState state) where TCreateShipmentMethodType : ICreateShipmentMethodType, new() where TMergePatchShipmentMethodType : IMergePatchShipmentMethodType, new() { bool bUnsaved = ((IShipmentMethodTypeState)state).IsUnsaved; if (bUnsaved) { return(state.ToCreateShipmentMethodType <TCreateShipmentMethodType>()); } else { return(state.ToMergePatchShipmentMethodType <TMergePatchShipmentMethodType>()); } }
public ShipmentMethodTypeStateDtoWrapper(IShipmentMethodTypeState state) { this._state = state; }
public ShipmentMethodTypeStateDtoWrapper() { this._state = new ShipmentMethodTypeState(); }