public virtual ColumnExpression AddToOrderBy( [NotNull] IProperty property, [NotNull] IQuerySource querySource, OrderingDirection orderingDirection) { Check.NotNull(property, "property"); Check.NotNull(property, "querySource"); var columnExpression = new ColumnExpression(property, FindTableForQuerySource(querySource).Alias); _orderBy.Add(new Ordering(columnExpression, orderingDirection)); return columnExpression; }
public virtual AliasExpression AddToOrderBy( [NotNull] string column, [NotNull] IProperty property, [NotNull] TableExpressionBase table, OrderingDirection orderingDirection) { Check.NotEmpty(column, nameof(column)); Check.NotNull(property, nameof(property)); Check.NotNull(table, nameof(table)); var columnExpression = new ColumnExpression(column, property, table); var aliasExpression = new AliasExpression(columnExpression); if (_orderBy.FindIndex(o => o.Expression.TryGetColumnExpression()?.Equals(columnExpression) ?? false) == -1) { _orderBy.Add(new Ordering(aliasExpression, orderingDirection)); } return aliasExpression; }
protected bool Equals(ColumnExpression other) => _property.Equals(other._property) && _tableExpression.Equals(other._tableExpression);