コード例 #1
0
        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);
        }
コード例 #2
0
        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);
        }
コード例 #3
0
        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);
        }
コード例 #4
0
        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();
        }
コード例 #5
0
 public override IShipmentMethodTypeAggregate GetShipmentMethodTypeAggregate(IShipmentMethodTypeState state)
 {
     return(new ShipmentMethodTypeAggregate(state));
 }
コード例 #6
0
 public ShipmentMethodTypeAggregate(IShipmentMethodTypeState state)
 {
     _state = state;
 }
コード例 #7
0
        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);
        }
コード例 #8
0
 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));
     }
 }
コード例 #9
0
 public abstract IShipmentMethodTypeAggregate GetShipmentMethodTypeAggregate(IShipmentMethodTypeState state);
コード例 #10
0
        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);
        }
コード例 #11
0
        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);
        }
コード例 #12
0
        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);
        }
コード例 #13
0
        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>());
            }
        }
コード例 #14
0
 public ShipmentMethodTypeStateDtoWrapper(IShipmentMethodTypeState state)
 {
     this._state = state;
 }
コード例 #15
0
 public ShipmentMethodTypeStateDtoWrapper()
 {
     this._state = new ShipmentMethodTypeState();
 }