I have a Linq query (Entity Framework) as
function getData(string col_to_sort , bool IsAscending , int pageNo , int pageSize)
{
context.table_name.Skip(pageNo*pageSize).Take(pageSize).ToArray();
}
I want that if I pass the column name as a function parameter and the order will sort my query too.
Since my column name will be a string, so we may need to convert it to ObjectQuery.
How can i achieve this?
Any help is appreciated.
source
share