本文整理汇总了C#中Remotion.Linq.Clauses.OrderByClause类的典型用法代码示例。如果您正苦于以下问题:C# OrderByClause类的具体用法?C# OrderByClause怎么用?C# OrderByClause使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
OrderByClause类属于Remotion.Linq.Clauses命名空间,在下文中一共展示了OrderByClause类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: VisitOrderByClause
public virtual void VisitOrderByClause(OrderByClause orderByClause, QueryModel queryModel, int index)
{
ArgumentUtility.CheckNotNull ("orderByClause", orderByClause);
ArgumentUtility.CheckNotNull ("queryModel", queryModel);
VisitOrderings (orderByClause.Orderings, queryModel, orderByClause);
}
示例2: VisitOrderByClause
public override void VisitOrderByClause(OrderByClause orderByClause, QueryModel queryModel, int index)
{
foreach (var ordering in orderByClause.Orderings)
{
model.AddSort(ordering.Expression, ordering.OrderingDirection);
}
}
示例3: Accept
/// <summary>
/// Accepts the specified visitor by calling its <see cref="IQueryModelVisitor.VisitOrdering"/> method.
/// </summary>
/// <param name="visitor">The visitor to accept.</param>
/// <param name="queryModel">The query model in whose context this clause is visited.</param>
/// <param name="orderByClause">The <see cref="OrderByClause"/> in whose context this item is visited.</param>
/// <param name="index">The index of this item in the <paramref name="orderByClause"/>'s <see cref="OrderByClause.Orderings"/> collection.</param>
public virtual void Accept (IQueryModelVisitor visitor, QueryModel queryModel, OrderByClause orderByClause, int index)
{
ArgumentUtility.CheckNotNull ("visitor", visitor);
ArgumentUtility.CheckNotNull ("queryModel", queryModel);
ArgumentUtility.CheckNotNull ("orderByClause", orderByClause);
visitor.VisitOrdering (this, queryModel, orderByClause, index);
}
示例4: ApplyNodeSpecificSemantics
protected override void ApplyNodeSpecificSemantics (QueryModel queryModel, ClauseGenerationContext clauseGenerationContext)
{
ArgumentUtility.CheckNotNull ("queryModel", queryModel);
var clause = new OrderByClause();
clause.Orderings.Add (new Ordering (GetResolvedKeySelector (clauseGenerationContext), OrderingDirection.Desc));
queryModel.BodyClauses.Add (clause);
}
示例5: VisitOrderByClause
public override void VisitOrderByClause(OrderByClause orderByClause, QueryModel queryModel, int index)
{
var joinDetector = new SelectAndOrderByJoinDetector(_nameGenerator, this, _joins, _expressionMap);
foreach (Ordering ordering in orderByClause.Orderings)
{
joinDetector.VisitExpression(ordering.Expression);
}
}
示例6: VisitOrderByClause
public override void VisitOrderByClause(OrderByClause orderByClause, QueryModel queryModel, int index)
{
var visitor = new EnigmaExpressionTreeVisitor(_objectExpression);
foreach (var ordering in orderByClause.Orderings) {
visitor.VisitExpression(ordering.Expression);
_objectExpression.OrderBy(ordering.OrderingDirection);
}
base.VisitOrderByClause(orderByClause, queryModel, index);
}
示例7: ConvertsToSort_Desc
public void ConvertsToSort_Desc()
{
var orderByClause = new OrderByClause();
orderByClause.Orderings.Add(new Ordering(new LuceneQueryFieldExpression(typeof(string), "Name"), OrderingDirection.Desc));
ExpectSortOnProperty("Name", SortField.STRING, OrderingDirection.Desc);
transformer.VisitOrderByClause(orderByClause, queryModel, 0);
Assert.That(transformer.Model.Sort.GetSort().Length, Is.EqualTo(1));
AssertSortFieldEquals(transformer.Model.Sort.GetSort()[0], "Name", OrderingDirection.Desc, SortField.STRING);
}
示例8: ConvertsDateTimeOffsetToSort
public void ConvertsDateTimeOffsetToSort()
{
var orderByClause = new OrderByClause();
orderByClause.Orderings.Add(new Ordering(new LuceneQueryFieldExpression(typeof(DateTimeOffset?), "Date"), OrderingDirection.Asc));
ExpectSortOnProperty("Date", SortField.LONG, OrderingDirection.Asc);
transformer.VisitOrderByClause(orderByClause, queryModel, 0);
Assert.That(transformer.Model.Sort.GetSort().Length, Is.EqualTo(1));
AssertSortFieldEquals(transformer.Model.Sort.GetSort()[0], "Date", OrderingDirection.Asc, SortField.LONG);
}
示例9: Apply
public void Apply ()
{
var clause = new OrderByClause ();
QueryModel.BodyClauses.Add (clause);
var result = _node.Apply (QueryModel, ClauseGenerationContext);
Assert.That (result, Is.SameAs (QueryModel));
Assert.That (clause.Orderings.Count, Is.EqualTo (1));
Assert.That (clause.Orderings[0].OrderingDirection, Is.EqualTo (OrderingDirection.Asc));
Assert.That (clause.Orderings[0].Expression, Is.SameAs (_node.GetResolvedKeySelector (ClauseGenerationContext)));
}
示例10: ConvertsDateTimeToSortNonNumeric
public void ConvertsDateTimeToSortNonNumeric()
{
var orderByClause = new OrderByClause();
orderByClause.Orderings.Add(new Ordering(new LuceneQueryFieldExpression(typeof(DateTimeOffset?), "Date"), OrderingDirection.Asc));
mappingInfo.Expect(m => m.GetMappingInfo("Date")).Return(nonNumericMappingInfo);
nonNumericMappingInfo.Stub(i => i.FieldName).Return("Date");
transformer.VisitOrderByClause(orderByClause, queryModel, 0);
Assert.That(transformer.Model.Sort.GetSort().Length, Is.EqualTo(1));
AssertSortFieldEquals(transformer.Model.Sort.GetSort()[0], "Date", OrderingDirection.Asc, SortField.STRING);
}
示例11: VisitOrderByClause
public override void VisitOrderByClause(OrderByClause orderByClause, QueryModel queryModel, int index)
{
Log.Trace(m => m("Original QueryModel: {0}", queryModel));
foreach (var visitor in orderingVisitors)
{
orderByClause.TransformExpressions(visitor.VisitExpression);
Log.Trace(m => m("Transformed QueryModel after {0}: {1}", visitor.GetType().Name, queryModel));
}
ExpandCompositeOrderings(orderByClause);
base.VisitOrderByClause(orderByClause, queryModel, index);
}
示例12: VisitOrderByClause
/// <summary>
/// 解析 orderby 语句
/// </summary>
/// <param name="orderByClause"></param>
/// <param name="queryModel"></param>
/// <param name="index"></param>
public override void VisitOrderByClause( OrderByClause orderByClause, QueryModel queryModel, int index )
{
foreach( var ordering in orderByClause.Orderings )
{
MySqlOrderByClauseVisitor visitor = new MySqlOrderByClauseVisitor( this.parameterAggregator );
string orderByParts = visitor.Translate( ordering.Expression );
string direction = ordering.OrderingDirection == OrderingDirection.Desc ? "DESC" : "ASC";
queryPartsAggregator.OrderByParts.Add( string.Format( "{0} {1}", orderByParts, direction ) );
}
base.VisitOrderByClause( orderByClause, queryModel, index );
}
示例13: SetUp
public void SetUp ()
{
_generator = new UniqueIdentifierGenerator();
_context = SqlStatementModelObjectMother.CreateSqlPreparationContext();
_defaultStage = new DefaultSqlPreparationStage (
CompoundMethodCallTransformerProvider.CreateDefault(), ResultOperatorHandlerRegistry.CreateDefault(), _generator);
_mainFromClause = ExpressionHelper.CreateMainFromClause<Cook>();
_selectClause = ExpressionHelper.CreateSelectClause (_mainFromClause);
_orderByClause = ExpressionHelper.CreateOrderByClause();
_queryModel = new QueryModel (_mainFromClause, _selectClause);
_stageMock = MockRepository.GenerateStrictMock<ISqlPreparationStage>();
_visitor = new TestableSqlPreparationQueryModelVisitor (_context, _stageMock);
_visitorPartialMock = MockRepository.GeneratePartialMock<TestableSqlPreparationQueryModelVisitor> (_context, _stageMock);
}
示例14: VisitOrderByClause
/// <summary>
/// 解析 orderby 语句
/// </summary>
/// <param name="orderByClause"></param>
/// <param name="queryModel"></param>
/// <param name="index"></param>
public override void VisitOrderByClause( OrderByClause orderByClause, QueryModel queryModel, int index )
{
foreach( var ordering in orderByClause.Orderings )
{
OracleOrderByPartsCommandBuilder orderBuilder = new OracleOrderByPartsCommandBuilder();
OracleOrderByClauseVisitor visitor = new OracleOrderByClauseVisitor();
visitor.Translate( ordering.Expression, orderBuilder );
string direction = ordering.OrderingDirection == OrderingDirection.Desc ? "desc" : "asc";
commandBuilder.OrderByParts.Add( string.Format( "{0} {1}", orderBuilder.ToString(), direction ) );
}
base.VisitOrderByClause( orderByClause, queryModel, index );
}
示例15: SetUp
public void SetUp ()
{
_mockRepository = new MockRepository();
_visitorMock = _mockRepository.StrictMock<TestQueryModelVisitor>();
_bodyClauseMock1 = _mockRepository.StrictMock<IBodyClause>();
_bodyClauseMock2 = _mockRepository.StrictMock<IBodyClause>();
_ordering1 = new Ordering (ExpressionHelper.CreateExpression(), OrderingDirection.Asc);
_ordering2 = new Ordering (ExpressionHelper.CreateExpression(), OrderingDirection.Asc);
_resultOperator1 = new TestResultOperator();
_resultOperator2 = new TestResultOperator();
_queryModel = ExpressionHelper.CreateQueryModel<Cook>();
_orderByClause = ExpressionHelper.CreateOrderByClause();
_groupJoinClause = ExpressionHelper.CreateGroupJoinClause<Cook>();
}