Hi,
Been trying to figure out how to do this in LLBLGen. I would like to return a single UsersEntity:
SELECT *
FROM users
WHERE username = 'blah'
AND password = 'deedah'
This will return 1 record. There is a unique constraint in the db on username, but no constraint defined on password, thus FetchUsingUniqueConstraint won't do it for me. I tried creating a PredicateBucket:
IRelationPredicateBucket filter = new RelationPredicateBucket();
filter.PredicateExpression.Add(
PredicateFactory.CompareValue(UsersFieldIndex.UserName, ComparisonOperator.Equal, userName));
filter.PredicateExpression.AddWithAnd(
PredicateFactory.CompareValue(UsersFieldIndex.Password, ComparisonOperator.Equal, password));
but then discovered that a bucket can't be passed into adapter.FetchEntity, only a PrefetchPath can. Since it's only querying one table, there's no appropriate PrefetchPath (that I could see).
I know I can do FetchEntityCollection or make a dynamic list, but it seems like there must be a straightforward way of querying one table using multiple predicates to return a single typed entity.
Thx,
Jack