This thread looks to be a little on the old side and therefore may no longer be relevant. Please see if there is a newer thread on the subject and ensure you're using the most recent build of any software if your question regards a particular product.
This thread has been locked and is no longer accepting new posts, if you have a question regarding this topic please email us at support@mindscape.co.nz
|
From what I've seen it is not possible to set the priority of different QueryExpressions in a query. Correct? An example to illustrate it. Imagen you have the following function in a repository (generic example)
WHERE
WHERE
Any chance of doing this without having to construct the whole SQL query? (i.e. using QueryExpressions with priorities).
|
|
|
You know what... The minute after I posted this example, I realize that I could actually get my example to work easily looking at the produced sql... How typical... All I needed to do was to change the order since you wisely inserted a parenthesis in the expression: Query query = new Query(); in my test this renders as desired: WHERE
|
|
|
Thanks for following up so that others who might be searching can find your solution. John-Daniel |
|
|
Hi Tobias, You can use parentheses in query expressions like so: (Entity.Attribute("Id") == 1 || Entity.Attribute("Id") == 2) && Entity.Attribute("Title").Like("A%") Additionally, you can use negation like: !Entity.Attribute("Contributor.Id").In(41, 42) Or: !Entity.Attribute("ApprovedBy.Comments").Exists() Cheers, Andrew. |
|
|
ehh. Embarrasing. |
|