public virtual void Initialize(IProductCategoryStateCreated stateCreated) { var aggregateId = stateCreated.ProductCategoryEventId.ProductCategoryId; var state = new ProductCategoryState(); state.ProductCategoryId = aggregateId; var aggregate = (ProductCategoryAggregate)GetProductCategoryAggregate(state); var eventStoreAggregateId = ToEventStoreAggregateId(aggregateId); aggregate.Apply(stateCreated); Persist(eventStoreAggregateId, aggregate, state); }
public virtual IProductCategoryState ToProductCategoryState() { var state = new ProductCategoryState(true); state.ProductCategoryId = this.ProductCategoryId; state.ProductCategoryTypeId = this.ProductCategoryTypeId; state.PrimaryParentCategoryId = this.PrimaryParentCategoryId; state.CategoryName = this.CategoryName; state.Description = this.Description; state.CategoryImageUrl = this.CategoryImageUrl; state.DetailScreen = this.DetailScreen; if (this.ShowInSelect != null && this.ShowInSelect.HasValue) { state.ShowInSelect = this.ShowInSelect.Value; } state.AttributeSetId = this.AttributeSetId; 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 static CreateProductCategory ToCreateProductCategory(this ProductCategoryState state) { return(state.ToCreateProductCategory <CreateProductCategory>()); }
public static MergePatchProductCategory ToMergePatchProductCategory(this ProductCategoryState state) { return(state.ToMergePatchProductCategory <MergePatchProductCategory>()); }
public static DeleteProductCategory ToDeleteProductCategory(this ProductCategoryState state) { return(state.ToDeleteProductCategory <DeleteProductCategory>()); }
public static IProductCategoryCommand ToCreateOrMergePatchProductCategory(this ProductCategoryState state) { return(state.ToCreateOrMergePatchProductCategory <CreateProductCategory, MergePatchProductCategory>()); }