public IGoodIdentificationMvoState Get(ProductGoodIdentificationId id) { IGoodIdentificationMvoState state = CurrentSession.Get <GoodIdentificationMvoState>(id); if (ReadOnlyProxyGenerator != null && state != null) { return(ReadOnlyProxyGenerator.CreateProxy <IGoodIdentificationMvoState>(state, new Type[] { }, _readOnlyPropertyNames)); } return(state); }
public IGoodIdentificationMvoState Get(ProductGoodIdentificationId id, bool nullAllowed) { IGoodIdentificationMvoState state = CurrentSession.Get <GoodIdentificationMvoState> (id); if (!nullAllowed && state == null) { state = new GoodIdentificationMvoState(); (state as GoodIdentificationMvoState).ProductGoodIdentificationId = id; } if (ReadOnlyProxyGenerator != null && state != null) { return(ReadOnlyProxyGenerator.CreateProxy <IGoodIdentificationMvoState>(state, new Type[] { }, _readOnlyPropertyNames)); } return(state); }
public async Task <IGoodIdentificationMvoState> GetAsync(ProductGoodIdentificationId productGoodIdentificationId) { IGoodIdentificationMvoState state = null; var idObj = GoodIdentificationMvoProxyUtils.ToIdString(productGoodIdentificationId); var uriParameters = new GoodIdentificationMvoUriParameters(); uriParameters.Id = idObj; var req = new GoodIdentificationMvoGetRequest(uriParameters); var resp = await _ramlClient.GoodIdentificationMvo.Get(req); GoodIdentificationMvoProxyUtils.ThrowOnHttpResponseError(resp); state = (resp.Content == null) ? null : resp.Content.ToGoodIdentificationMvoState(); return(state); }
public void Save(IGoodIdentificationMvoState state) { IGoodIdentificationMvoState s = state; if (ReadOnlyProxyGenerator != null) { s = ReadOnlyProxyGenerator.GetTarget <IGoodIdentificationMvoState>(state); } CurrentSession.SaveOrUpdate(s); var saveable = s as ISaveable; if (saveable != null) { saveable.Save(); } CurrentSession.Flush(); }
public override IGoodIdentificationMvoAggregate GetGoodIdentificationMvoAggregate(IGoodIdentificationMvoState state) { return(new GoodIdentificationMvoAggregate(state)); }
public static TMergePatchGoodIdentificationMvo ToMergePatchGoodIdentificationMvo <TMergePatchGoodIdentificationMvo>(this IGoodIdentificationMvoState state) where TMergePatchGoodIdentificationMvo : IMergePatchGoodIdentificationMvo, new() { var cmd = new TMergePatchGoodIdentificationMvo(); cmd.ProductVersion = ((IGoodIdentificationMvoStateProperties)state).ProductVersion; cmd.ProductGoodIdentificationId = state.ProductGoodIdentificationId; cmd.IdValue = state.IdValue; cmd.Version = ((IGoodIdentificationMvoStateProperties)state).Version; cmd.Active = ((IGoodIdentificationMvoStateProperties)state).Active; cmd.ProductProductTypeId = state.ProductProductTypeId; cmd.ProductPrimaryProductCategoryId = state.ProductPrimaryProductCategoryId; cmd.ProductManufacturerPartyId = state.ProductManufacturerPartyId; cmd.ProductFacilityId = state.ProductFacilityId; cmd.ProductIntroductionDate = state.ProductIntroductionDate; cmd.ProductReleaseDate = state.ProductReleaseDate; cmd.ProductSupportDiscontinuationDate = state.ProductSupportDiscontinuationDate; cmd.ProductSalesDiscontinuationDate = state.ProductSalesDiscontinuationDate; cmd.ProductSalesDiscWhenNotAvail = state.ProductSalesDiscWhenNotAvail; cmd.ProductInternalName = state.ProductInternalName; cmd.ProductBrandName = state.ProductBrandName; cmd.ProductComments = state.ProductComments; cmd.ProductProductName = state.ProductProductName; cmd.ProductDescription = state.ProductDescription; cmd.ProductPriceDetailText = state.ProductPriceDetailText; cmd.ProductSmallImageUrl = state.ProductSmallImageUrl; cmd.ProductMediumImageUrl = state.ProductMediumImageUrl; cmd.ProductLargeImageUrl = state.ProductLargeImageUrl; cmd.ProductDetailImageUrl = state.ProductDetailImageUrl; cmd.ProductOriginalImageUrl = state.ProductOriginalImageUrl; cmd.ProductDetailScreen = state.ProductDetailScreen; cmd.ProductInventoryMessage = state.ProductInventoryMessage; cmd.ProductInventoryItemTypeId = state.ProductInventoryItemTypeId; cmd.ProductRequireInventory = state.ProductRequireInventory; cmd.ProductQuantityUomId = state.ProductQuantityUomId; cmd.ProductQuantityIncluded = state.ProductQuantityIncluded; cmd.ProductPiecesIncluded = state.ProductPiecesIncluded; cmd.ProductRequireAmount = state.ProductRequireAmount; cmd.ProductFixedAmount = state.ProductFixedAmount; cmd.ProductAmountUomTypeId = state.ProductAmountUomTypeId; cmd.ProductWeightUomId = state.ProductWeightUomId; cmd.ProductShippingWeight = state.ProductShippingWeight; cmd.ProductProductWeight = state.ProductProductWeight; cmd.ProductHeightUomId = state.ProductHeightUomId; cmd.ProductProductHeight = state.ProductProductHeight; cmd.ProductShippingHeight = state.ProductShippingHeight; cmd.ProductWidthUomId = state.ProductWidthUomId; cmd.ProductProductWidth = state.ProductProductWidth; cmd.ProductShippingWidth = state.ProductShippingWidth; cmd.ProductDepthUomId = state.ProductDepthUomId; cmd.ProductProductDepth = state.ProductProductDepth; cmd.ProductShippingDepth = state.ProductShippingDepth; cmd.ProductDiameterUomId = state.ProductDiameterUomId; cmd.ProductProductDiameter = state.ProductProductDiameter; cmd.ProductProductRating = state.ProductProductRating; cmd.ProductRatingTypeEnum = state.ProductRatingTypeEnum; cmd.ProductReturnable = state.ProductReturnable; cmd.ProductTaxable = state.ProductTaxable; cmd.ProductChargeShipping = state.ProductChargeShipping; cmd.ProductAutoCreateKeywords = state.ProductAutoCreateKeywords; cmd.ProductIncludeInPromotions = state.ProductIncludeInPromotions; cmd.ProductIsVirtual = state.ProductIsVirtual; cmd.ProductIsVariant = state.ProductIsVariant; cmd.ProductVirtualVariantMethodEnum = state.ProductVirtualVariantMethodEnum; cmd.ProductInShippingBox = state.ProductInShippingBox; cmd.ProductDefaultShipmentBoxTypeId = state.ProductDefaultShipmentBoxTypeId; cmd.ProductIsSerialNumbered = state.ProductIsSerialNumbered; cmd.ProductIsManagedByLot = state.ProductIsManagedByLot; cmd.ProductAttributeSetId = state.ProductAttributeSetId; cmd.ProductAttributeSetInstanceId = state.ProductAttributeSetInstanceId; cmd.ProductCreatedBy = state.ProductCreatedBy; cmd.ProductCreatedAt = state.ProductCreatedAt; cmd.ProductUpdatedBy = state.ProductUpdatedBy; cmd.ProductUpdatedAt = state.ProductUpdatedAt; cmd.ProductActive = state.ProductActive; if (state.IdValue == null) { cmd.IsPropertyIdValueRemoved = true; } if (state.ProductProductTypeId == null) { cmd.IsPropertyProductProductTypeIdRemoved = true; } if (state.ProductPrimaryProductCategoryId == null) { cmd.IsPropertyProductPrimaryProductCategoryIdRemoved = true; } if (state.ProductManufacturerPartyId == null) { cmd.IsPropertyProductManufacturerPartyIdRemoved = true; } if (state.ProductFacilityId == null) { cmd.IsPropertyProductFacilityIdRemoved = true; } if (state.ProductIntroductionDate == null) { cmd.IsPropertyProductIntroductionDateRemoved = true; } if (state.ProductReleaseDate == null) { cmd.IsPropertyProductReleaseDateRemoved = true; } if (state.ProductSupportDiscontinuationDate == null) { cmd.IsPropertyProductSupportDiscontinuationDateRemoved = true; } if (state.ProductSalesDiscontinuationDate == null) { cmd.IsPropertyProductSalesDiscontinuationDateRemoved = true; } if (state.ProductSalesDiscWhenNotAvail == null) { cmd.IsPropertyProductSalesDiscWhenNotAvailRemoved = true; } if (state.ProductInternalName == null) { cmd.IsPropertyProductInternalNameRemoved = true; } if (state.ProductBrandName == null) { cmd.IsPropertyProductBrandNameRemoved = true; } if (state.ProductComments == null) { cmd.IsPropertyProductCommentsRemoved = true; } if (state.ProductProductName == null) { cmd.IsPropertyProductProductNameRemoved = true; } if (state.ProductDescription == null) { cmd.IsPropertyProductDescriptionRemoved = true; } if (state.ProductPriceDetailText == null) { cmd.IsPropertyProductPriceDetailTextRemoved = true; } if (state.ProductSmallImageUrl == null) { cmd.IsPropertyProductSmallImageUrlRemoved = true; } if (state.ProductMediumImageUrl == null) { cmd.IsPropertyProductMediumImageUrlRemoved = true; } if (state.ProductLargeImageUrl == null) { cmd.IsPropertyProductLargeImageUrlRemoved = true; } if (state.ProductDetailImageUrl == null) { cmd.IsPropertyProductDetailImageUrlRemoved = true; } if (state.ProductOriginalImageUrl == null) { cmd.IsPropertyProductOriginalImageUrlRemoved = true; } if (state.ProductDetailScreen == null) { cmd.IsPropertyProductDetailScreenRemoved = true; } if (state.ProductInventoryMessage == null) { cmd.IsPropertyProductInventoryMessageRemoved = true; } if (state.ProductInventoryItemTypeId == null) { cmd.IsPropertyProductInventoryItemTypeIdRemoved = true; } if (state.ProductRequireInventory == null) { cmd.IsPropertyProductRequireInventoryRemoved = true; } if (state.ProductQuantityUomId == null) { cmd.IsPropertyProductQuantityUomIdRemoved = true; } if (state.ProductQuantityIncluded == null) { cmd.IsPropertyProductQuantityIncludedRemoved = true; } if (state.ProductPiecesIncluded == null) { cmd.IsPropertyProductPiecesIncludedRemoved = true; } if (state.ProductRequireAmount == null) { cmd.IsPropertyProductRequireAmountRemoved = true; } if (state.ProductFixedAmount == null) { cmd.IsPropertyProductFixedAmountRemoved = true; } if (state.ProductAmountUomTypeId == null) { cmd.IsPropertyProductAmountUomTypeIdRemoved = true; } if (state.ProductWeightUomId == null) { cmd.IsPropertyProductWeightUomIdRemoved = true; } if (state.ProductShippingWeight == null) { cmd.IsPropertyProductShippingWeightRemoved = true; } if (state.ProductProductWeight == null) { cmd.IsPropertyProductProductWeightRemoved = true; } if (state.ProductHeightUomId == null) { cmd.IsPropertyProductHeightUomIdRemoved = true; } if (state.ProductProductHeight == null) { cmd.IsPropertyProductProductHeightRemoved = true; } if (state.ProductShippingHeight == null) { cmd.IsPropertyProductShippingHeightRemoved = true; } if (state.ProductWidthUomId == null) { cmd.IsPropertyProductWidthUomIdRemoved = true; } if (state.ProductProductWidth == null) { cmd.IsPropertyProductProductWidthRemoved = true; } if (state.ProductShippingWidth == null) { cmd.IsPropertyProductShippingWidthRemoved = true; } if (state.ProductDepthUomId == null) { cmd.IsPropertyProductDepthUomIdRemoved = true; } if (state.ProductProductDepth == null) { cmd.IsPropertyProductProductDepthRemoved = true; } if (state.ProductShippingDepth == null) { cmd.IsPropertyProductShippingDepthRemoved = true; } if (state.ProductDiameterUomId == null) { cmd.IsPropertyProductDiameterUomIdRemoved = true; } if (state.ProductProductDiameter == null) { cmd.IsPropertyProductProductDiameterRemoved = true; } if (state.ProductProductRating == null) { cmd.IsPropertyProductProductRatingRemoved = true; } if (state.ProductRatingTypeEnum == null) { cmd.IsPropertyProductRatingTypeEnumRemoved = true; } if (state.ProductReturnable == null) { cmd.IsPropertyProductReturnableRemoved = true; } if (state.ProductTaxable == null) { cmd.IsPropertyProductTaxableRemoved = true; } if (state.ProductChargeShipping == null) { cmd.IsPropertyProductChargeShippingRemoved = true; } if (state.ProductAutoCreateKeywords == null) { cmd.IsPropertyProductAutoCreateKeywordsRemoved = true; } if (state.ProductIncludeInPromotions == null) { cmd.IsPropertyProductIncludeInPromotionsRemoved = true; } if (state.ProductIsVirtual == null) { cmd.IsPropertyProductIsVirtualRemoved = true; } if (state.ProductIsVariant == null) { cmd.IsPropertyProductIsVariantRemoved = true; } if (state.ProductVirtualVariantMethodEnum == null) { cmd.IsPropertyProductVirtualVariantMethodEnumRemoved = true; } if (state.ProductInShippingBox == null) { cmd.IsPropertyProductInShippingBoxRemoved = true; } if (state.ProductDefaultShipmentBoxTypeId == null) { cmd.IsPropertyProductDefaultShipmentBoxTypeIdRemoved = true; } if (state.ProductAttributeSetId == null) { cmd.IsPropertyProductAttributeSetIdRemoved = true; } if (state.ProductAttributeSetInstanceId == null) { cmd.IsPropertyProductAttributeSetInstanceIdRemoved = true; } if (state.ProductCreatedBy == null) { cmd.IsPropertyProductCreatedByRemoved = true; } if (state.ProductUpdatedBy == null) { cmd.IsPropertyProductUpdatedByRemoved = true; } return(cmd); }
public static TDeleteGoodIdentificationMvo ToDeleteGoodIdentificationMvo <TDeleteGoodIdentificationMvo>(this IGoodIdentificationMvoState state) where TDeleteGoodIdentificationMvo : IDeleteGoodIdentificationMvo, new() { var cmd = new TDeleteGoodIdentificationMvo(); cmd.ProductGoodIdentificationId = state.ProductGoodIdentificationId; cmd.ProductVersion = ((IGoodIdentificationMvoStateProperties)state).ProductVersion; return(cmd); }
public static IGoodIdentificationMvoCommand ToCreateOrMergePatchGoodIdentificationMvo <TCreateGoodIdentificationMvo, TMergePatchGoodIdentificationMvo>(this IGoodIdentificationMvoState state) where TCreateGoodIdentificationMvo : ICreateGoodIdentificationMvo, new() where TMergePatchGoodIdentificationMvo : IMergePatchGoodIdentificationMvo, new() { bool bUnsaved = ((IGoodIdentificationMvoState)state).IsUnsaved; if (bUnsaved) { return(state.ToCreateGoodIdentificationMvo <TCreateGoodIdentificationMvo>()); } else { return(state.ToMergePatchGoodIdentificationMvo <TMergePatchGoodIdentificationMvo>()); } }
public GoodIdentificationMvoAggregate(IGoodIdentificationMvoState state) { _state = state; }
protected bool IsRepeatedCommand(IGoodIdentificationMvoCommand command, IEventStoreAggregateId eventStoreAggregateId, IGoodIdentificationMvoState state) { bool repeated = false; if (((IGoodIdentificationMvoStateProperties)state).ProductVersion > command.AggregateVersion) { var lastEvent = EventStore.GetEvent(typeof(IGoodIdentificationMvoEvent), eventStoreAggregateId, command.AggregateVersion); if (lastEvent != null && lastEvent.CommandId == command.CommandId) { repeated = true; } } return(repeated); }
private void Persist(IEventStoreAggregateId eventStoreAggregateId, IGoodIdentificationMvoAggregate aggregate, IGoodIdentificationMvoState state) { EventStore.AppendEvents(eventStoreAggregateId, ((IGoodIdentificationMvoStateProperties)state).ProductVersion, aggregate.Changes, () => { StateRepository.Save(state); }); if (AggregateEventListener != null) { AggregateEventListener.EventAppended(new AggregateEvent <IGoodIdentificationMvoAggregate, IGoodIdentificationMvoState>(aggregate, state, aggregate.Changes)); } }
public abstract IGoodIdentificationMvoAggregate GetGoodIdentificationMvoAggregate(IGoodIdentificationMvoState state);