Question

I've got this code to create entityQuery for loading my entities:

if (filterExpresion != null)
{
    riaQuery = riaQuery.Where(
        Expression.Lambda(
            filterExpresion,
            Expression.Parameter(typeof(TEntity), "item") // NOI18N
            ) as Expression<Func<TEntity, bool>>
        );
}

if (OrderBy != null)
{
    var orderByExpression = 
        Expression.Lambda<Func<TEntity, int>>(
            OrderBy, 
            Expression.Parameter(typeof(TEntity), "item")
        );

    riaQuery.OrderBy(orderByExpression);
}

so.. Where clause is setted and i can see it in Query-property of riaQuery, but i can't see any OrderBy clause and i have no orderby-filtering in this query.

riaQuery.IsComposable == true

Why OrderBy do not appliyng to Query?

Was it helpful?

Solution

OrderBy returns the resulting IOrderedQueryable. change to:

riaQuery = riaQuery.OrderBy(orderByExpression);
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top