Meteor wrote:
I'm using the SelfServicing model with LLBLGen Pro v2., SQL Server 2000 database.
I have a Users table and a Roles table which are joined by a linking table (ie m:n via UsersInRoles).
I need to retrieve a collection of Users matching a wildcard search (FieldLikePredicate?) for a particular role.
I can retrieve the list of users ok, using role.GetMultiUsersCollectionViaUsersInRoles(true), but there's no overload to accept a filter on the Usernames. I can't find any way to filter on the newly retrieved list of users, either. Somehow I think I'm barking up the wrong tree.
Can you throw some light on the subject? Thanks.
To elaborate on what David said:
you need a GetMulti call on the UserCollection. You then pass a relation collection with 2 relation:
User - UsersInRole
UsersInRole already contains RoleID, so you don't have to specify UsersInRole - Role.
You then also specify a predicateexpression with the following filter:
PredicateExpression filter = new PredicateExpression();
filter.Add(UserFields.UserName % myPattern);
filter.AddWithAnd(UsersInRoleFields.RoleID==roleID);
The getmulti call on the usercollection will then fetch all users which match that filter and use the relation in the relationcollection.