query assistance

Posts   
 
    
skhan
User
Posts: 15
Joined: 29-Mar-2011
# Posted on: 29-Jul-2011 21:23:38   

Hi, How would I write the following query in LLBLGen runtime



select a.* from dbo.customersGeoData a
inner join dbo.overlayCustomers b
on a.CustomerID = b.CustomerID
inner join dbo.overlays c
on b.OverlayID = c.OverlayID
and c.OverlayID = '2B6DB4D4-9634-46F0-8DBF-86A80601A9C6'


daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 30-Jul-2011 08:33:01   
var customerGeos = new EntityCollection<CustomerGeoDataEntity>();

var filter = new RelationPredicateBucket();
filter.Relations.Add(CustomerGeoDataEntity.Relations.OverlayCustomerEntityUsingCustomerId);
filter.Relations.Add(OverlayCustomerEntity.Relations.OverlayEntityUsingOverlayId);
filter.PredicateExpression.Add(OverlayFields.OverlayId == '2B6DB4D4-9634-46F0-8DBF-86A80601A9C6');

using (var adapter = new DataAccessAdapter())
{
     adapter.FetchEntityCollection(customerGeos);
}

This is explained in detail in the manual: Filtering and Sorting.

David Elizondo | LLBLGen Support Team