Beispiel #1
0
        public virtual IUomState ToUomState()
        {
            var state = new UomState(true);

            state.UomId        = this.UomId;
            state.UomTypeId    = this.UomTypeId;
            state.Abbreviation = this.Abbreviation;
            state.Description  = this.Description;
            if (this.Active != null && this.Active.HasValue)
            {
                state.Active = this.Active.Value;
            }
            if (this.Version != null && this.Version.HasValue)
            {
                state.Version = this.Version.Value;
            }
            state.CreatedBy = this.CreatedBy;
            if (this.CreatedAt != null && this.CreatedAt.HasValue)
            {
                state.CreatedAt = this.CreatedAt.Value;
            }
            state.UpdatedBy = this.UpdatedBy;
            if (this.UpdatedAt != null && this.UpdatedAt.HasValue)
            {
                state.UpdatedAt = this.UpdatedAt.Value;
            }

            return(state);
        }
        public virtual void Initialize(IUomStateCreated stateCreated)
        {
            var aggregateId = stateCreated.UomEventId.UomId;
            var state       = new UomState();

            state.UomId = aggregateId;
            var aggregate = (UomAggregate)GetUomAggregate(state);

            var eventStoreAggregateId = ToEventStoreAggregateId(aggregateId);

            aggregate.Apply(stateCreated);
            Persist(eventStoreAggregateId, aggregate, state);
        }
Beispiel #3
0
 public static CreateUom ToCreateUom(this UomState state)
 {
     return(state.ToCreateUom <CreateUom>());
 }
Beispiel #4
0
 public static MergePatchUom ToMergePatchUom(this UomState state)
 {
     return(state.ToMergePatchUom <MergePatchUom>());
 }
Beispiel #5
0
 public static DeleteUom ToDeleteUom(this UomState state)
 {
     return(state.ToDeleteUom <DeleteUom>());
 }
Beispiel #6
0
 public static IUomCommand ToCreateOrMergePatchUom(this UomState state)
 {
     return(state.ToCreateOrMergePatchUom <CreateUom, MergePatchUom>());
 }