I have a FutureQuery and a sortexpression like

var sortOn = sortSpec.PropertyName;
var param = Expression.Parameter(typeof(TestPieceDto), "tp");
var parts = sortOn.Split('.');
Expression parent = param;

 foreach (var part in parts)
{
    parent = Expression.Property(parent, part);
}

var sortExpression = Expression.Lambda<Func<TestPieceDto, 
DateTime?>>(parent, param);

var test = futureQuery.OrderByDescending(sortExpression);

I get the following error:

Unable to cast object of type 
'DataAccess.NHibernate.Linq.FutureQuery`1[Measurement.Model.Test.TestPieceDto]' 
to type 
'System.Linq.IOrderedQueryable`1[Measurement.Model.Test.TestPieceDto]'.

Is OrderBy supported on FutureQuery ? If so, then how do we do it ? Any 
examples ? All I see in the internet is all about OrderBy in linq 
statements and IQueryables on direct property access. In my case, I want to 
OrderBy based on a *PropertyName string in runtime*.

-- 
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/nhusers.
For more options, visit https://groups.google.com/d/optout.

Reply via email to