Prefetch Problem

Posts   
 
    
Kristian
User
Posts: 30
Joined: 24-Feb-2005
# Posted on: 09-Mar-2005 01:38:07   

Hello,

I am new to prefetch's, so please bear with me. smile

I am trying to use the following code to only bring back the records where the quantity is 15. Anyone see what I am doing wrong? P

         Dim Customers As New EntityCollection(New CustomerEntityFactory)
        Dim Adapter As New DatabaseSpecific.DataAccessAdapter

        Dim Prefetch As New PrefetchPath2(CType(EntityType.CustomerEntity, Integer))
        Dim Filter As New RelationPredicateBucket

        Prefetch.Add(CustomerEntity.PrefetchPathOrders).SubPath.Add(OrderEntity.PrefetchPathOrderDetails)
        Filter.PredicateExpression.Add(PredicateFactory.CompareValue(OrderDetailFieldIndex.Quantity, ComparisonOperator.Equal, 15))

        Adapter.FetchEntityCollection(Customers, Filter, Prefetch)
Otis avatar
Otis
LLBLGen Pro Team
Posts: 39933
Joined: 17-Aug-2003
# Posted on: 09-Mar-2005 09:18:55   

Pass the filter for orderdetails to the Subpath add overload so the filter is added to the fetch of the orderdetails simple_smile

Frans Bouma | Lead developer LLBLGen Pro