I have an issue with sorting a table. The table columns looks something like this:
| ID | Property1: Object | Property2: Object | Property3: int |
|---|
The table has a sorting options that currently sorts something like this: .OrderBy(e => EF.Property<object>(e,sortingColumn)) where sortingColumn is the name of the property/column that is being sorted on.
This is working fine for properties such as the ID or Property3 which is an int. But on my object properties it defaults to sorting on their ID. For those I want it to order by another subproperty such as Code. Meaning that is the sortingColumn = Property2 I want it to order by Property2.Code.
Is there any good way to achieve this without making custom sorting methods for each column?