simple odata client filter nested collection

1.1k Views Asked by At

I have the following odata query:

/Places?$filter=CountryCode eq 'de'&$expand=Images($filter=IsCover eq true)

The Places has a collection of Images. This query returns back all places for "DE" and for each place only the Image that has the property IsCover true

How can I write this in fluent API?

I tried following:

return await _oDataClient
                .For<Place>()
                .Filter(p => p.CountryCode == "DE"))
                .Expand(f => f.Images.Where(i => i.IsCover == true))
                .FindEntriesAsync();

but it keeps giving and exception. Is there any way to write this in fluent API?

0

There are 0 best solutions below