I have a TaskCategory table and it has a ParentCategoryId field which links to itself so you can have a parent and child task category.
I have a list that combines the parent and child so you can select them from a combo box, i.e.:
Parent Category Name 1 --> Child Category Name 1
Parent Category Name 1 --> ChildCategory Name 2
Parent Category Name 2 --> Child Category Name 3
I would like to sort the list by the Parent Category Name and then the Child Category name but I can't quite figure out how.
The code below is only ordering by the child category name...but I want it to sort by the parent category name first which is the related entity in the prefetch path.
I'd appreciate any help that you can provide...
var qf = new QueryFactory();
var q = qf.TaskCategory
.Where(TaskCategoryFields.IsDeleted.Equal(false).Or(TaskCategoryFields.IsDeleted.IsNull()))
.AndWhere(TaskCategoryFields.IsVerified.Equal(true))
.AndWhere(TaskCategoryFields.ParentCategoryId.NotEqual(0))
.WithPath(TaskCategoryEntity.PrefetchPathParentCategory
.WithOrdering(TaskCategoryFields.Name.Ascending())
)
.OrderBy(TaskCategoryFields.Name.Ascending());