ChilliCream / ChilliCream/graphql-platform

Support for Sort using EFCore.SqlServer.HierarchyId property

Open
#5,422 1 comment 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

🌶️ hot chocolate Area: EntityFramework
Dominant language
C#
Stars
5.8k
Forks
810
Avg merge
15h 39m
Merged PRs (30d)
98

Description

Is your feature request related to a problem?

Eventual goal: Sort IQuerable collection by EFCore.SqlServer.HierarchyId property.

We have a hierarchyId (https://github.com/efcore/EFCore.SqlServer.HierarchyId) column inside a POCO object.

Alternative 1:

If HierarchyId column wasn't ignored then the following exception is thrown:

System.InvalidOperationException: 'No compatible constructor found for input type type `Microsoft.EntityFrameworkCore.HierarchyId`.
Either you have to provide a public constructor with settable properties or a public constructor that allows to pass in values for read-only properties.There was no way to set the following properties: .'

Alternative 2:

We ignored HierarchyId property and then used a resolver to expose this column. Now, data cannot be sorted by this resolved property since sorting as of now doesn't support the resolved columns.

The solution you'd like

Ability to sort by a resolved field OR ability to expose a HierarchyId column in schema.

Product

Hot Chocolate

Contributor guide

Open the contributing guide

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 at Hot Chocolate's sorting support for resolved fields and the EFCore.SqlServer.HierarchyId property described in the issue. Determine whether sorting a resolved field or exposing the HierarchyId column is the more appropriate supported path, then verify that IQueryable collections can sort by the hierarchy value and that the behavior is covered by a regression test.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.