Hello, I'm new to LLBLGen Pro (still using demoversion).
I'd like to do some filtering on related fields and I can't get it to work.
I'm using Selfservicing, LLBLGen 2.5, .NET 2.5.
I have 3 tables (with their relevant fields):
tPerson (PersonID)
tGroupPerson (PersonID, GroupID)
tGroup (GroupID) - added for clarity but not used in example
I like to find all persons which are in group1 AND group2 AND group3.
So far I came up with the next (not working) simplefied code:
PredicateExpression filter = new PredicateExpression();
myRelations = new RelationCollection();
myRelations.Add(TPersonEntity.Relations.TGroupPersonEntityUsingPersonId);
TPersonCollection persons = new TPersonCollection();
filter.AddWithAnd(TGroupPersonFields.GroupId == 1);
filter.AddWithAnd(TGroupPersonFields.GroupId == 2);
filter.AddWithAnd(TGroupPersonFields.GroupId == 3);
persons.GetMulti(filter, myRelations);
This ends up with zero persons, which is logical if you think of a database join.
I think I need cascading filtering of the persons Collection. So, first filter on GroupId =1, then filter the result on GroupId=2, etc. But I can't get this to work.
Can anybody give me a hint on how to do this?