public void GenerateTextForOrdering (ISqlCommandBuilder commandBuilder, Ordering ordering)
{
ArgumentUtility.CheckNotNull ("commandBuilder", commandBuilder);
ArgumentUtility.CheckNotNull ("ordering", ordering);
if (ordering.Expression.NodeType == ExpressionType.Constant || ordering.Expression is SqlLiteralExpression)
{
commandBuilder.Append ("(SELECT ");
GenerateTextForOrderByExpression (commandBuilder, ordering.Expression);
commandBuilder.Append (")");
}
else
GenerateTextForOrderByExpression (commandBuilder, ordering.Expression);
commandBuilder.AppendFormat (string.Format (" {0}", ordering.OrderingDirection.ToString ().ToUpper ()));
}