public virtual ISupplierProductEvent GetEvent(SupplierProductId supplierProductId, long version)
        {
            var e = (ISupplierProductEvent)EventStore.GetEvent(ToEventStoreAggregateId(supplierProductId), version);

            if (e != null)
            {
                e.ReadOnly = true;
            }
            else if (version == -1)
            {
                return(GetEvent(supplierProductId, 0));
            }
            return(e);
        }
Beispiel #2
0
        public override bool Equals(object obj)
        {
            if (Object.ReferenceEquals(this, obj))
            {
                return(true);
            }

            SupplierProductId other = obj as SupplierProductId;

            if (other == null)
            {
                return(false);
            }

            return(true &&
                   Object.Equals(this.ProductId, other.ProductId) &&
                   Object.Equals(this.PartyId, other.PartyId) &&
                   Object.Equals(this.CurrencyUomId, other.CurrencyUomId) &&
                   Object.Equals(this.MinimumOrderQuantity, other.MinimumOrderQuantity)
                   );
        }
 public abstract IEventStoreAggregateId ToEventStoreAggregateId(SupplierProductId aggregateId);
        public virtual ISupplierProductState GetHistoryState(SupplierProductId supplierProductId, long version)
        {
            var eventStream = EventStore.LoadEventStream(typeof(ISupplierProductEvent), ToEventStoreAggregateId(supplierProductId), version - 1);

            return(new SupplierProductState(eventStream.Events));
        }
        public virtual ISupplierProductState Get(SupplierProductId supplierProductId)
        {
            var state = StateRepository.Get(supplierProductId, true);

            return(state);
        }
Beispiel #6
0
 public SupplierProductEventId(SupplierProductId supplierProductId, long version)
 {
     this._supplierProductId = supplierProductId;
     this._version           = version;
 }