You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
we've been using WhereSql in our project and we noticed it does not put parentheses around the statement. This can lead to unexpected behaviour.
Example
IQueryProvider<User> query = DbAccess.DB.Query<User>();
query = query.Where(u => u.Email.Contains("o"));
query = query.WhereSql("firstname LIKE '%o%' OR lastname LIKE '%o%'");
returns all users where lastname contains 'o', even though it was constrained to email containing 'o'. The rendered query does not have a parentheses around the statement "firstname LIKE '%o%' OR lastname LIKE '%o%'", rendering the email condition useless.
This is in contrast to the following example using pure Where statements
Hi,
we've been using WhereSql in our project and we noticed it does not put parentheses around the statement. This can lead to unexpected behaviour.
Example
returns all users where lastname contains 'o', even though it was constrained to email containing 'o'. The rendered query does not have a parentheses around the statement "firstname LIKE '%o%' OR lastname LIKE '%o%'", rendering the email condition useless.
This is in contrast to the following example using pure Where statements
Here the rendered query does have parentheses around the rendered second condition, not rendering the email condition useless.
This leads to different results, although the intention of both statements was the same.
The text was updated successfully, but these errors were encountered: