Add IQueryable support as GetList overload with LINQ-to-OData translation #65
+1,521
−0
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Enables LINQ Where clauses to automatically translate to OData $filter parameters, eliminating manual filter string construction and providing type-safe queries. Implemented as an overload of the existing
GetList()method.Implementation
Core Components
EntityQueryProvider- IQueryProvider that intercepts LINQ expressions and invokes GetListAsync with translated OData parametersEntityQueryable<T>- IQueryable wrapper with async execution methods (ToListAsync, FirstAsync, CountAsync, etc.)ExpressionToQueryParametersVisitor- Expression tree visitor that translates LINQ to OData:==,!=,>,>=,<,<=→eq,ne,gt,ge,lt,le&&,||,!→and,or,notContains(),StartsWith(),EndsWith()→ OData functionsTake(),Skip()→$top,$skipGetList<T>(asQueryable: true)overload on ApiClient that returnsIQueryable<EntityType>Key Details
DataMemberattributes for proper JSON property name serialization (e.g.,Date.Value→Date/value)andUsage
Testing
14 new tests covering filter generation, pagination, async execution, filter combination, and URL encoding. All existing tests pass.
Original prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.