I am using asp.net core v2.1, I have a controller inheriting from Controller that contains an action with a parameter decorated with FromQuery based on the following model:
public class PagingControl<T>
{
public ColumnSort[] ColumnSorts { get; set; }
public T ColumnFilters { get; set; }
public int Page { get; set; }
public int PerPage { get; set; }
}
public class ColumnSort
{
public string Field { get; set; }
public SortType Type { get; set; }
}
public enum SortType
{
Asc = 0,
Desc
}
The generic parameter represents a flat poco with nullable properties that provide well defined columns and values to filter with. The PagingControl<T> model describes all parameters required to implement paging with the action.
The ColumnSorts property is a collection as multiple successive column sorting is possible.
I have read Array or List in query string does not get parsed however if I understand this, I cannot have a single model that accepts all query parameters.
In order to successfully implement the full functionality of paging, all parameters are required. This worked fine when ColumnSorts was not a collection, consistent with single column sorting.
Does anyone know of a workaround with a query string for this scenario?
