Пример #1
0
        public virtual IUomConversionState ToUomConversionState()
        {
            var state = new UomConversionState(true);

            state.UomConversionId  = this.UomConversionId;
            state.ConversionFactor = this.ConversionFactor;
            state.CustomMethodId   = this.CustomMethodId;
            state.DecimalScale     = this.DecimalScale;
            state.RoundingMode     = this.RoundingMode;
            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(IUomConversionStateCreated stateCreated)
        {
            var aggregateId = stateCreated.UomConversionEventId.UomConversionId;
            var state       = new UomConversionState();

            state.UomConversionId = aggregateId;
            var aggregate = (UomConversionAggregate)GetUomConversionAggregate(state);

            var eventStoreAggregateId = ToEventStoreAggregateId(aggregateId);

            aggregate.Apply(stateCreated);
            Persist(eventStoreAggregateId, aggregate, state);
        }
Пример #3
0
 public static CreateUomConversion ToCreateUomConversion(this UomConversionState state)
 {
     return(state.ToCreateUomConversion <CreateUomConversion>());
 }
Пример #4
0
 public static MergePatchUomConversion ToMergePatchUomConversion(this UomConversionState state)
 {
     return(state.ToMergePatchUomConversion <MergePatchUomConversion>());
 }
Пример #5
0
 public static DeleteUomConversion ToDeleteUomConversion(this UomConversionState state)
 {
     return(state.ToDeleteUomConversion <DeleteUomConversion>());
 }
Пример #6
0
 public static IUomConversionCommand ToCreateOrMergePatchUomConversion(this UomConversionState state)
 {
     return(state.ToCreateOrMergePatchUomConversion <CreateUomConversion, MergePatchUomConversion>());
 }