I have a wep api project consumes data using odata but I\'m having some problems with odata wep api.
when I execute that query
/api/values?$to
As the exception message tells you, the query that you have is invalid.
/api/values?$top=50&$filter=Comments/Fortuneteller/FullName eq 'some string'
is equivalent to the linq expression
fortuneDTOs.Where(f => f.Comments.Fortuneteller.FullName == "some string").Top(50)
As you can see fortuneDTOs.Comments.Fortuneteller
is incorrect as Comments is a collection and it doesn't have a property named 'FullName'.
You should use Any/All to filter on collections. For example, if you are trying to find all the fortunes where one of the commentators is 'some string', you can do
/api/values?$top=50&$filter=Comments/any(c: c/Fortuneteller/FullName eq 'some string')
If instead you want to find out all the fortunes where all the comments are made by only one commentator 'some string', you can do
/api/values?$top=50&$filter=Comments/all(c: c/Fortuneteller/FullName eq 'some string')