Thanks for that. I have sorted my problem for the time being. I really need to take a look at the LLBGen Datasource...
For the moment I am using the SortParameterName attribute of the ObjectDatasource, then using that info i build a SortExpression, that seems to works well...
Cheers
Luis
protected ISortExpression GetSortExpression<TEntity>(string sortExpression) where TEntity : EntityBase2, IEntity2, new()
{
ISortExpression output = null;
if (!string.IsNullOrEmpty(sortExpression))
{
string[] bits = sortExpression.Split(' ');
IEntityFieldCore field = GetFieldByColumn<TEntity>(bits[0]);
SortOperator sort = SortOperator.Ascending;
if (bits.Length > 1)
{
sort = GetSortOperator(bits[1]);
}
output = new SortExpression(new SortClause(field,null, sort));
}
return output;
}
private IEntityFieldCore GetFieldByColumn<TEntity>(string fieldName) where TEntity : EntityBase2, IEntity2,new()
{
return new TEntity().GetFieldByName(fieldName);
}
private SortOperator GetSortOperator(string operatordesc)
{
return (operatordesc.ToLower()=="desc")?SortOperator.Descending:SortOperator.Ascending;
}