Ejemplo n.º 1
0
        public virtual void Initialize(ISellableInventoryItemEntryMvoStateCreated stateCreated)
        {
            var aggregateId = stateCreated.SellableInventoryItemEntryMvoEventId.SellableInventoryItemEntryId;
            var state       = new SellableInventoryItemEntryMvoState();

            state.SellableInventoryItemEntryId = aggregateId;
            var aggregate = (SellableInventoryItemEntryMvoAggregate)GetSellableInventoryItemEntryMvoAggregate(state);

            var eventStoreAggregateId = ToEventStoreAggregateId(aggregateId);

            aggregate.Apply(stateCreated);
            Persist(eventStoreAggregateId, aggregate, state);
        }
        public virtual ISellableInventoryItemEntryMvoState ToSellableInventoryItemEntryMvoState()
        {
            var state = new SellableInventoryItemEntryMvoState(true);

            state.SellableInventoryItemEntryId = this.SellableInventoryItemEntryId;
            if (this.SellableQuantity != null && this.SellableQuantity.HasValue)
            {
                state.SellableQuantity = this.SellableQuantity.Value;
            }
            state.SourceEventId = this.SourceEventId;
            if (this.Version != null && this.Version.HasValue)
            {
                state.Version = this.Version.Value;
            }
            if (this.SellableInventoryItemSellableQuantity != null && this.SellableInventoryItemSellableQuantity.HasValue)
            {
                state.SellableInventoryItemSellableQuantity = this.SellableInventoryItemSellableQuantity.Value;
            }
            state.SellableInventoryItemCreatedBy = this.SellableInventoryItemCreatedBy;
            if (this.SellableInventoryItemCreatedAt != null && this.SellableInventoryItemCreatedAt.HasValue)
            {
                state.SellableInventoryItemCreatedAt = this.SellableInventoryItemCreatedAt.Value;
            }
            state.SellableInventoryItemUpdatedBy = this.SellableInventoryItemUpdatedBy;
            if (this.SellableInventoryItemUpdatedAt != null && this.SellableInventoryItemUpdatedAt.HasValue)
            {
                state.SellableInventoryItemUpdatedAt = this.SellableInventoryItemUpdatedAt.Value;
            }
            if (this.SellableInventoryItemVersion != null && this.SellableInventoryItemVersion.HasValue)
            {
                state.SellableInventoryItemVersion = this.SellableInventoryItemVersion.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);
        }
Ejemplo n.º 3
0
 public static CreateSellableInventoryItemEntryMvo ToCreateSellableInventoryItemEntryMvo(this SellableInventoryItemEntryMvoState state)
 {
     return(state.ToCreateSellableInventoryItemEntryMvo <CreateSellableInventoryItemEntryMvo>());
 }
Ejemplo n.º 4
0
 public static MergePatchSellableInventoryItemEntryMvo ToMergePatchSellableInventoryItemEntryMvo(this SellableInventoryItemEntryMvoState state)
 {
     return(state.ToMergePatchSellableInventoryItemEntryMvo <MergePatchSellableInventoryItemEntryMvo>());
 }
Ejemplo n.º 5
0
 public static DeleteSellableInventoryItemEntryMvo ToDeleteSellableInventoryItemEntryMvo(this SellableInventoryItemEntryMvoState state)
 {
     return(state.ToDeleteSellableInventoryItemEntryMvo <DeleteSellableInventoryItemEntryMvo>());
 }
Ejemplo n.º 6
0
 public static ISellableInventoryItemEntryMvoCommand ToCreateOrMergePatchSellableInventoryItemEntryMvo(this SellableInventoryItemEntryMvoState state)
 {
     return(state.ToCreateOrMergePatchSellableInventoryItemEntryMvo <CreateSellableInventoryItemEntryMvo, MergePatchSellableInventoryItemEntryMvo>());
 }