Interesting filtering scenario.

Posts   
 
    
blackgold9
User
Posts: 8
Joined: 26-May-2006
# Posted on: 20-Jul-2006 20:32:43   

I have the following data schema

Genere->Tracks_Generes<-Tracks

I need to be able to query all tracks in specific generes or combinations of generes. How would i go about setting that up in LLBLGen?

bclubb
User
Posts: 934
Joined: 12-Feb-2004
# Posted on: 21-Jul-2006 03:08:39   

This example uses the Adapter scenario and is from Generated code - Advanced filter usage, Adapter - Multi-entity filters in the manual.

EntityCollection tracks = new EntityCollection(new TrackEntityFactory());
RelationPredicateBucket bucket = new RelationPredicateBucket();
bucket.Relations.Add(TrackEntity.Relations.Tracks_GeneresEntityUsingTrackID);
bucket.Relations.Add(Tracks_GeneresEntity.Relations.GenereEntityUsingGenereID);
bucket.PredicateExpression.Add(GenereFields.Name == "Rock");
bucket.PredicateExpression.AddWithOr(GenereFields.Name == "Comedy");
DataAccessAdapter adapter = new DataAccessAdapter();
adapter.FetchEntityCollection(tracks, bucket);