private bool ContainsProjection(ICollection <IProjection> projections, OrderByItemSegment orderItem)
        {
            if (projections.IsNotEmpty() && orderItem is IndexOrderByItemSegment)
            {
                return(true);
            }

            foreach (var projection in projections)
            {
                if (IsSameAlias(projection, (TextOrderByItemSegment)orderItem) || IsSameQualifiedName(projection, (TextOrderByItemSegment)orderItem))
                {
                    return(true);
                }
            }
            return(false);
        }
Ejemplo n.º 2
0
 public OrderByItem(OrderByItemSegment segment)
 {
     _segment = segment;
 }
 private bool ContainsProjection(ICollection <IProjection> projections, OrderByItemSegment orderByItemSegment, SelectCommand selectCommand)
 {
     return(orderByItemSegment is IndexOrderByItemSegment ||
            ContainsItemInShorthandProjection(projections, orderByItemSegment, selectCommand) || ContainsProjection(projections, orderByItemSegment));
 }
        private bool ContainsItemWithoutOwnerInShorthandProjections(ICollection <IProjection> projections, OrderByItemSegment orderItem, SelectCommand selectCommand)
        {
            if (orderItem is ColumnOrderByItemSegment columnOrderByItemSegment)
            {
                if (columnOrderByItemSegment.GetColumn().GetOwner() == null)
                {
                    foreach (var shorthandProjection in GetQualifiedShorthandProjections(projections))
                    {
                        if (IsSameProjection(shorthandProjection, (ColumnOrderByItemSegment)orderItem, selectCommand))
                        {
                            return(true);
                        }
                    }
                }
            }


            return(false);
        }
 private bool ContainsItemWithOwnerInShorthandProjections(ICollection <IProjection> projections, OrderByItemSegment orderItem, SelectCommand selectCommand)
 {
     return(orderItem is ColumnOrderByItemSegment columnOrderByItemSegment && columnOrderByItemSegment.GetColumn().GetOwner() != null &&
            FindShorthandProjection(projections, columnOrderByItemSegment.GetColumn().GetOwner().GetIdentifier().GetValue(), selectCommand) != null);
 }
 private bool ContainsItemInShorthandProjection(ICollection <IProjection> projections, OrderByItemSegment orderByItemSegment, SelectCommand selectCommand)
 {
     return(IsUnqualifiedShorthandProjection(projections) || ContainsItemWithOwnerInShorthandProjections(projections, orderByItemSegment, selectCommand) ||
            ContainsItemWithoutOwnerInShorthandProjections(projections, orderByItemSegment, selectCommand));
 }