ZEXSM / OData.QueryBuilder

OData.QueryBuilder - library for creating complex OData queries (OData version 4.01) based on data models with linq syntax.
MIT License
72 stars 31 forks source link

Empty any #71

Closed h3rmanj closed 3 years ago

h3rmanj commented 3 years ago

Sometimes you just want to know if a sublist has any, no matter what.

Users?$Filter=Friends/any()

Right now, you have to provide a function to .Any, forcing you to do

.For<User>("Users")
.ByList()
.Filter((u, _, o) => o.Any(u.Friends, f => true))

that generates

Users?$Filter=Friends/any(f:true)

Which technically works (I think), but it would be nice if the 2nd argument func in .Any was optional.