コード例 #1
0
        public virtual void When(ILocatorTypeStateCreated e)
        {
            ThrowOnWrongEvent(e);
            this.Description = e.Description;

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

            this.Deleted = false;

            this.CreatedBy = e.CreatedBy;
            this.CreatedAt = e.CreatedAt;
        }
コード例 #2
0
        public virtual LocatorTypeStateCreatedDto ToLocatorTypeStateCreatedDto(ILocatorTypeStateCreated e)
        {
            var dto = new LocatorTypeStateCreatedDto();

            dto.LocatorTypeEventId = e.LocatorTypeEventId;
            dto.CreatedAt          = e.CreatedAt;
            dto.CreatedBy          = e.CreatedBy;
            dto.CommandId          = e.CommandId;
            dto.Description        = e.Description;
            dto.Active             = e.Active;
            return(dto);
        }
コード例 #3
0
        public virtual void Initialize(ILocatorTypeStateCreated stateCreated)
        {
            var aggregateId = stateCreated.LocatorTypeEventId.LocatorTypeId;
            var state       = new LocatorTypeState();

            state.LocatorTypeId = aggregateId;
            var aggregate = (LocatorTypeAggregate)GetLocatorTypeAggregate(state);

            var eventStoreAggregateId = ToEventStoreAggregateId(aggregateId);

            aggregate.Apply(stateCreated);
            Persist(eventStoreAggregateId, aggregate, state);
        }
コード例 #4
0
        protected virtual ILocatorTypeStateCreated Map(ICreateLocatorType c)
        {
            var stateEventId           = new LocatorTypeEventId(c.LocatorTypeId, c.Version);
            ILocatorTypeStateCreated e = NewLocatorTypeStateCreated(stateEventId);

            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 ILocatorTypeState.When(ILocatorTypeStateCreated e)
 {
     throw new NotSupportedException();
 }
コード例 #6
0
        public virtual void Create(ICreateLocatorType c)
        {
            ILocatorTypeStateCreated e = Map(c);

            Apply(e);
        }