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
|
Hi there I have this query: return (from dev in uow.Developers I get an SQL exception: "In der Nähe von 'OR' wurde ein nicht boolescher Ausdruck in einem Kontext angegeben, in dem eine Bedingung erwartet wird." Near to the "OR" a not boolean term was defined within a context that expected a condition. If I comment out the two marked (**) lines the error disappears - but the sql query is not what I want. Both, SearchForDeveloperName and SearchForAddInName = string.Empty; Any ideas? |
|
|
We had an issue with && expressions where the first element was a constant True and the second element was a complex clause containing another boolean constant (in your case, another True). There will be a fix in the next nightly build. As an interim workaround, you might be able eliminate the || expressions by resolving empty strings to wildcards: string dn = String.IsNullOrEmpty(DevName) ? "*" : DevName; ... where LikeOperator.LikeString(dev.Name, dn, CompareMethod.Text) && ... Haven't tried this though. |
|
|
That was fast - thanks Ivan! Sure, in terms of valid SQL your interim solution is right - in terms of performance it is not optimal.
|
|
|
Just installed the current version. Since I needed to modify the base entity I downloaded the source and apply my changes. Now I didn't get even where clause?! ==================================================================== var q = (from dev in uow.Developers ==================================================================== SELECT
==================================================================== Modified source: using System; Any Ideas? |
|
|
Correct. As you said in the original message, both of your SearchForXxx strings are empty. Therefore both String.IsNullOrEmpty calls return true. Therefore both ||-expressions are true. Therefore the &&-expression is true. Therefore the query is going to return all results. Therefore there is no WHERE clause. |
|
|
Huh - I didn't expected that LS is smart enough to do such pre-evaluations. Thanks for the clarification!
|
|