Llblgen Starter Question

Posts   
 
    
Rainbow
User
Posts: 29
Joined: 23-Feb-2004
# Posted on: 25-Feb-2004 15:18:35   

Hi Frans,

Just started using your tool and I'm very impressed. I just have a very simple question with regards to filtering the returned result.

At the moment I have multiple tables but for this example they are:

Directory DirectoryCategory Category

I retrieve the Directory Entity based on an id and then get a list of categories that belong to that directory.

But the CategoryEntity has two properties I wish to be able to filter on.......ParentID and Type (Live, NoneLive).


   DataAccessAdapter adapter = new DataAccessAdapter();
   DirectoryEntity directory = new DirectoryEntity(1);
   adapter.FetchEntity(directory);

  Title.Text = directory.Title.ToString();
   Description.Text = directory.Summary.ToString();

 EntityCollection categories = directory.CategoryElements;

 adapter.FetchEntityCollection(categories,directory.GetRelationInfoCategoryElements());

 directoryContainer.DataSource = categories;
    
 directoryContainer.DataBind();

My question is this.........how do I pass the GetRelationInfo and my two filters?

Thanks,

John

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39590
Joined: 17-Aug-2003
# Posted on: 25-Feb-2004 16:45:51   

simple_smile

The RelationPredicateBucket object returned by the directory.GetRelationInfoCategoryElements() call contains a PredicateExpression property. You can add your predicates to that expression and then pass the RelationPredicateBucket to the Fetch call.

Thus: IRelationPredicateBucket bucket = directory.GetRelationInfoCategoryElements(); // bucket contains relations collection and filters already, just add filter with and bucket.PredicateExpression.AddWithAnd(PredicateFactory.CompareValue.... );

adapter.FetchEntityCollection(categories, bucket);

Frans Bouma | Lead developer LLBLGen Pro
Rainbow
User
Posts: 29
Joined: 23-Feb-2004
# Posted on: 25-Feb-2004 17:11:07   

Hi Frans,

Thanks that did the trick!

John

Otis wrote:

simple_smile

The RelationPredicateBucket object returned by the directory.GetRelationInfoCategoryElements() call contains a PredicateExpression property. You can add your predicates to that expression and then pass the RelationPredicateBucket to the Fetch call.

Thus: IRelationPredicateBucket bucket = directory.GetRelationInfoCategoryElements(); // bucket contains relations collection and filters already, just add filter with and bucket.PredicateExpression.AddWithAnd(PredicateFactory.CompareValue.... );

adapter.FetchEntityCollection(categories, bucket);