Skip to content

Predicate can't parse #402

Closed Answered by phnx47
minik42 asked this question in Q&A
Aug 1, 2024 · 2 comments · 1 reply
Discussion options

You must be logged in to vote

@minik42 It's difficult to parse. This library supports only simple expressions by design. Use Raw SQL or try this

public IEnumerable GetMessages(int recipientId, bool? isRead)
{
    if (isRead.HasValue) 
    {
        return SetLimit(1, 10)
            .FindAll(x => x.Recipient_Id == recipientId && x.IsRead == isRead);
    } 
    else 
    {
        return SetLimit(1, 10)
            .FindAll(x => x.Recipient_Id == recipientId);
    }
}

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@phnx47
Comment options

Answer selected by phnx47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #401 on August 01, 2024 16:17.