コード例 #1
0
        public virtual void Initialize(IShipmentTypeStateCreated stateCreated)
        {
            var aggregateId = stateCreated.ShipmentTypeEventId.ShipmentTypeId;
            var state       = new ShipmentTypeState();

            state.ShipmentTypeId = aggregateId;
            var aggregate = (ShipmentTypeAggregate)GetShipmentTypeAggregate(state);

            var eventStoreAggregateId = ToEventStoreAggregateId(aggregateId);

            aggregate.Apply(stateCreated);
            Persist(eventStoreAggregateId, aggregate, state);
        }
コード例 #2
0
ファイル: ShipmentTypeState.cs プロジェクト: uwitec/wms-8
        public virtual void When(IShipmentTypeStateCreated e)
        {
            ThrowOnWrongEvent(e);
            this.ParentTypeId = e.ParentTypeId;

            this.HasTable = e.HasTable;

            this.Description = e.Description;

            this.Active = (e.Active != null && e.Active.HasValue) ? e.Active.Value : default(bool);

            this.CreatedBy = e.CreatedBy;
            this.CreatedAt = e.CreatedAt;
        }
コード例 #3
0
        public virtual ShipmentTypeStateCreatedDto ToShipmentTypeStateCreatedDto(IShipmentTypeStateCreated e)
        {
            var dto = new ShipmentTypeStateCreatedDto();

            dto.ShipmentTypeEventId = e.ShipmentTypeEventId;
            dto.CreatedAt           = e.CreatedAt;
            dto.CreatedBy           = e.CreatedBy;
            dto.CommandId           = e.CommandId;
            dto.ParentTypeId        = e.ParentTypeId;
            dto.HasTable            = e.HasTable;
            dto.Description         = e.Description;
            dto.Active = e.Active;
            return(dto);
        }
コード例 #4
0
ファイル: ShipmentTypeAggregate.cs プロジェクト: uwitec/wms-8
        protected virtual IShipmentTypeStateCreated Map(ICreateShipmentType c)
        {
            var stateEventId            = new ShipmentTypeEventId(c.ShipmentTypeId, c.Version);
            IShipmentTypeStateCreated e = NewShipmentTypeStateCreated(stateEventId);

            e.ParentTypeId = c.ParentTypeId;
            e.HasTable     = c.HasTable;
            e.Description  = c.Description;
            e.Active       = c.Active;
            e.CommandId    = c.CommandId;


            e.CreatedBy = (string)c.RequesterId;
            e.CreatedAt = ApplicationContext.Current.TimestampService.Now <DateTime>();
            var version = c.Version;


            return(e);
        }
コード例 #5
0
 void IShipmentTypeState.When(IShipmentTypeStateCreated e)
 {
     throw new NotSupportedException();
 }
コード例 #6
0
ファイル: ShipmentTypeAggregate.cs プロジェクト: uwitec/wms-8
        public virtual void Create(ICreateShipmentType c)
        {
            IShipmentTypeStateCreated e = Map(c);

            Apply(e);
        }