OData / OData/AspNetCoreOData

Enable $this in query options

Open
#94 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C#
Stars
505
Forks
186
PR merge metrics
No merged PRs in 30d

Description

In OData spec, the $this literal can be used in $filter and $orderby expressions nested within $expand and $select for collection-valued properties and navigation properties. It refers to the current instance of the collection. OData Version 4.01. Part 2: URL Conventions (oasis-open.org)

Examples

// select only email addresses ending with .com

http://host/service/Customers?$select=EmailAddresses($filter=endswith($this,'.com'))

// Select and orderby EmailAddresses. 

// EmailAddresses is a collection of primitive types

http://host/service/Customers?$select=EmailAddresses($orderby=$this)

There's some tests skipped owning $this. see at:
https://github.com/OData/AspNetCoreOData/blob/master/test/Microsoft.AspNetCore.OData.Tests/Query/Expressions/SelectExpandBinderTest.cs#L513

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the skipped tests in test/Microsoft.AspNetCore.OData.Tests/Query/Expressions/SelectExpandBinderTest.cs around line 513, and compare them with the OData 4.01 behavior described in the issue. Trace the select/expand query binding entry point used by those tests. Done means the relevant $filter and $orderby cases using $this are enabled and pass.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
api
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.