Hi Everyone,
Just wondering what would be the best approach to the following problem.
Products may have multiple Sizes. The Product -> Size data is held in a Product Size Entity.
Product Sizes can be deactivated.
Aim is to retrieve a list of all Sizes that do not currently exist in an Active Product Size.
I started off using the following
'Retrieve all Active Sizes for the current Product
Dim lProductSizeFilter As New PredicateExpression
lProductSizeFilter.Add(HelperClasses.ProductSizeFields.FkProductId = CurrentEntity.PkProductId)
lProductSizeFilter.AddWithAnd(HelperClasses.ProductSizeFields.Active = True)
Dim sizesFilter As IPredicateExpression = New PredicateExpression()
sizesFilter.Add(New FieldCompareSetPredicate(HelperClasses.SizeFields.PkSizeId, HelperClasses.ProductSizeFields.FkSizeId, SetOperator.In, lProductSizeFilter, True))
sizesFilter.Add(New PredicateExpression(HelperClasses.SizeFields.Active = True))
Dim lSortOrder As New SortExpression(New SortClause(HelperClasses.SizeFields.Name, SortOperator.Ascending))
mAvailableSizes.GetMulti(sizesFilter, 0, lSortOrder)
But the problem is that this pulls back the results based on what is currently stored in the DB and not from the entities being used.
What's the best way this can be changed to give a list based on the current collection of Product Sizes in memory?