public static IQueryStage GetOrderByStage( IQueryStage previousStage, OrderByClause orderByClause, VisitorMetadata visitorMetadata, HashSet <PropertyInfo> usedProperties) { if (previousStage is GroupedStage groupedStage) { OrderByAggregationsVisitor orderByAggregationsVisitor = new OrderByAggregationsVisitor(groupedStage, visitorMetadata); orderByClause.Accept(orderByAggregationsVisitor); foreach (var property in orderByAggregationsVisitor.UsedProperties) { usedProperties.Add(property); } return(new GroupedOrderByStage( groupedStage.CurrentType, groupedStage.ValueType, groupedStage.TypeInfo, groupedStage.KeyTypeInfo, groupedStage.ParameterExpression, groupedStage.KeyParameterExpression, groupedStage.ValueParameterExpression, groupedStage.FromAliases, orderByAggregationsVisitor.SortItems.ToImmutableList() )); } else { OrderByPlainVisitor visitor = new OrderByPlainVisitor(previousStage, visitorMetadata); orderByClause.Accept(visitor); foreach (var property in visitor.UsedProperties) { usedProperties.Add(property); } return(new OrderByStage( previousStage.CurrentType, previousStage.TypeInfo, previousStage.ParameterExpression, previousStage.FromAliases, visitor.SortItems.ToImmutableList() )); } }
public override void AcceptChildren(WSqlFragmentVisitor visitor) { if (OrderByClause != null) { OrderByClause.Accept(visitor); } base.AcceptChildren(visitor); }
public void TestOrderByClauseAccept() { Mock <KoraliumSqlVisitor> mock = new Mock <KoraliumSqlVisitor>(); OrderByClause orderByClause = new OrderByClause(); orderByClause.Accept(mock.Object); mock.Verify(x => x.VisitOrderByClause(orderByClause)); }
public void Accept() { var repository = new MockRepository(); var queryModel = ExpressionHelper.CreateQueryModel <Cook> (); var visitorMock = repository.StrictMock <IQueryModelVisitor>(); visitorMock.VisitOrderByClause(_orderByClause, queryModel, 1); repository.ReplayAll(); _orderByClause.Accept(visitorMock, queryModel, 1); repository.VerifyAll(); }