Has anyone done much with the specification pattern? I've start playing
around with it a bit, and I've hit a limitation pretty early on. 

 

For example, I'm trying to get a list of entity, by another value on
another entity, which does not have a direct link(navigation point).

 

The linq query on the context is something like this (without using
specification pattern)

 

    Dim q = From c In _context.Coupons _
            Join l In _context.Products _
            On c.Product.ProductNo Equals l.ProductNo _
            Join r In _context.Prices _
            On l.ProductNo Equals r.Products.ProductNo _
            Where c.couponNo = couponNo _ 'Param value here 
            And r.StartDate <= c.OfferDate _
            And (r.EndDate Is Nothing OrElse r.EndDate >= c.OfferDate) _
            Select r

 

This is attempting to get all the prices whose Start and EndDate
encapsulate the coupons offer date.

 

Because I don't have a context with the specification pattern, I need to
do it all from the perspective of the Price (this is a Price
specification, get prices by coupon), but I can't navigate from the
price to the product or coupons. I almost need the specification to be
in the perspective of the context (a level up), but I'm not sure.

 

Anyone come across this trying to implement this pattern? Any work
arounds\ideas?

 

Thanks

 

 

 

 

<<image002.jpg>>

Reply via email to