Skip to content

Can Linq lib generate query for nested AND/or filters? #919

Description

@susanhuhu

I have code below
DataServiceQuery.DataServiceOrderedQuery)container.Docs.Where(d =>
(d.SourceType == "Commercial" && d.ApplicationName == "all_up")
|| (d.SourceType == "Consumer" && d.ApplicationName == appName));

with Odata clint lib 7.20.0, it generates a query as below
$filter=SourceType eq 'Commercial' and ApplicationName eq 'all_up' or SourceType eq 'Consumer' and ApplicationName eq 'OWA'

It doesn't add () for sub queries so the filter is wrong. How can I workaround this issue please? Or Odata client library doesn't support such nested queries?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions