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?
OrderBy returns the resulting IOrderedQueryable
. change to:
riaQuery = riaQuery.OrderBy(orderByExpression);