You should use DBFunctionCall, set this expression on a field and pass it in the sortclause:
ResultsetFields fields = new ResultsetFields(1);
fields.DefineField(CustomerFields.ContactName, 0);
EntityField2 sortField = new EntityField2("theLen", new DbFunctionCall("LEN", new object[] { CustomerFields.ContactName }));
SortClause lenSortClause = new SortClause(sortField, null, SortOperator.Ascending);
lenSortClause.EmitAliasForExpressionAggregateField = false;
SortExpression sorter = new SortExpression(lenSortClause);
DataTable results = new DataTable();
using (DataAccessAdapter adapter = new DataAccessAdapter())
{
adapter.FetchTypedList(fields, results, null, 0, sorter, true);
}
You also can do that using EntityCollection instead of DynamicList.
Hope helpful