У меня есть столбец таблицы DB, где некоторые свойства хранятся как JSON. Вот пример: < /p>
properties
----------
{ "SortBy" : "ASC" }
< /code>
List items = await this.dbContext.AllItems
.Where(x => x.field.CompanyId== CompanyId)
.OrderBy(x => x.Value);
< /code>
I need to change the OrderBy based on that JSON value. It can be ASC, DESC, or no OrderBy() if there is no value in there.
The sort column "properties" is in the same table as AllItems. I will need to dynamically sort the column based on properties JSON.
Any suggestions?
Подробнее здесь: https://stackoverflow.com/questions/797 ... lue-exists