本文整理汇总了C#中DbSkipExpression类的典型用法代码示例。如果您正苦于以下问题:C# DbSkipExpression类的具体用法?C# DbSkipExpression怎么用?C# DbSkipExpression使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
DbSkipExpression类属于命名空间,在下文中一共展示了DbSkipExpression类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Visit
public override Expression Visit(DbSkipExpression expression)
{
Expression source = this.Visit(expression.Input.Expression);
Type sourceType = TypeHelper.GetElementType(source.Type);
// Skip cannot be used without sorting
Expression result = this.CreateOrderByExpression(expression.SortOrder, expression.Input.VariableName, source);
return queryMethodExpressionBuilder.Skip(result, this.Visit(expression.Count, typeof(int)));
}
示例2: Visit
/// <summary>
/// Implements the visitor pattern for <see cref="T:System.Data.Common.CommandTrees.DbSkipExpression"/>.
/// </summary>
/// <param name="expression">The <see cref="T:System.Data.Common.CommandTrees.DbSkipExpression"/> that is visited.</param>
public override void Visit(DbSkipExpression expression)
{
if (expression == null)
{
throw new ArgumentNullException("expression");
}
expression.Count.Accept(this);
expression.Input.Expression.Accept(this);
foreach (var sortClause in expression.SortOrder)
{
sortClause.Expression.Accept(this);
}
}
示例3: SkipLifter
internal SkipLifter(DbSkipExpression skip, AliasGenerator aliasGenerator)
: base(skip, aliasGenerator)
{
_skip = skip;
_source = skip.Input.Expression;
}
示例4: ProjectSkipLifter
internal ProjectSkipLifter(DbProjectExpression project, DbSkipExpression skip, AliasGenerator aliasGenerator)
: base(project, aliasGenerator)
{
_project = project;
_skip = skip;
_source = _skip.Input.Expression;
}
示例5: LimitSkipLifter
internal LimitSkipLifter(DbLimitExpression limit, DbSkipExpression skip, AliasGenerator aliasGenerator)
: base(limit, aliasGenerator)
{
_limit = limit;
_skip = skip;
_source = skip.Input.Expression;
}
示例6: Visit
public override DbExpression Visit(DbSkipExpression expression)
{
Check.NotNull(expression, "expression");
var found = Find(expression.Input.Expression);
if (!ReferenceEquals(found, expression.Input.Expression))
{
return found.BindAs(expression.Input.VariableName).Skip(expression.SortOrder, expression.Count);
}
else
{
return expression;
}
}
示例7: Visit
public override SqlFragment Visit(DbSkipExpression expression)
{
SelectStatement select = VisitInputExpressionEnsureSelect(expression.Input.Expression, expression.Input.VariableName,
expression.Input.VariableType);
foreach (DbSortClause sortClause in expression.SortOrder)
{
select.AddOrderBy(
new SortFragment(sortClause.Expression.Accept(this), sortClause.Ascending));
}
select = WrapIfNotCompatible(select, expression.ExpressionKind);
select.Skip = expression.Count.Accept(this);
return select;
}
示例8: Visit
/// <summary>
/// Logicaly, <see cref="DbSkipExpression"/> translates to:
/// SELECT Y.x1, Y.x2, ..., Y.xn
/// FROM (
/// SELECT X.x1, X.x2, ..., X.xn,
/// FROM input AS X
/// EXCEPT
/// SELECT TOP(count) Z.x1, Z.x2, ..., Z.xn
/// FROM input AS Z
/// ORDER BY sk1, sk2, ...
/// ) AS Y
/// ORDER BY sk1, sk2, ...
///
/// Here, input refers to the input of the <see cref="DbSkipExpression"/>, and count to the count property of the <see cref="DbSkipExpression"/>.
/// The implementation of EXCEPT is non-duplicate eliminating, and does equality comparison only over the
/// equality comparable columns of the input.
///
/// This corresponds to the following expression tree:
///
/// SORT
/// |
/// NON-DISTINCT EXCEPT (specially translated, <see cref="TransformIntersectOrExcept(DbExpression left, DbExpression right, DbExpressionKind expressionKind, IList<DbPropertyExpression> sortExpressionsOverLeft, string sortExpressionsBindingVariableName)"/>
/// |
/// | - Left: clone of input
/// | - Right:
/// |
/// Limit
/// |
/// | - Limit: Count
/// | - Input
/// |
/// Sort
/// |
/// input
///
/// </summary>
/// <param name="e"></param>
/// <returns></returns>
public override DbExpression Visit(DbSkipExpression e)
{
//Build the right input of the except
DbExpression rightInput = VisitExpressionBinding(e.Input).Sort(VisitSortOrder(e.SortOrder)).Limit(VisitExpression(e.Count));
//Build the left input for the except
var leftInput = VisitExpression(e.Input.Expression); //Another copy of the input
var sortOrder = VisitSortOrder(e.SortOrder); //Another copy of the sort order
// Create a list of the sort expressions to be used for translating except
IList<DbPropertyExpression> sortExpressions = new List<DbPropertyExpression>(e.SortOrder.Count);
foreach (var sortClause in sortOrder)
{
//We only care about property expressions, not about constants
if (sortClause.Expression.ExpressionKind
== DbExpressionKind.Property)
{
sortExpressions.Add((DbPropertyExpression)sortClause.Expression);
}
}
var exceptExpression = TransformIntersectOrExcept(
leftInput, rightInput, DbExpressionKind.Skip, sortExpressions, e.Input.VariableName);
DbExpression result = exceptExpression.BindAs(e.Input.VariableName).Sort(sortOrder);
return result;
}
示例9: Visit
public override void Visit(DbSkipExpression expression)
{
throw new NotSupportedException("Visit(\"SkipExpression\") is not supported.");
}
示例10: Visit
/// <summary>
/// Visitor pattern method for DbSkipExpression.
/// </summary>
/// <param name="expression"> The DbSkipExpression that is being visited. </param>
public abstract void Visit(DbSkipExpression expression);
示例11: Visit
/// <summary>
/// Visitor pattern method for <see cref="DbSkipExpression"/>.
/// </summary>
/// <param name="expression">The DbSkipExpression that is being visited.</param>
/// <exception cref="ArgumentNullException"><paramref name="expression"/> is null</exception>
public override void Visit(DbSkipExpression expression)
{
// #433613: PreSharp warning 56506: Parameter 'expression' to this public method must be validated: A null-dereference can occur here.
EntityUtil.CheckArgumentNull(expression, "expression");
VisitExpressionBindingPre(expression.Input);
foreach (DbSortClause sortKey in expression.SortOrder)
{
VisitExpression(sortKey.Expression);
}
VisitExpressionBindingPost(expression.Input);
VisitExpression(expression.Count);
}
示例12: Visit
public override void Visit(DbSkipExpression e)
{
Begin(e);
Dump(e.Input, "Input");
Dump(e.SortOrder);
Dump(e.Count, "Count");
End(e);
}
示例13: Visit
public override void Visit(DbSkipExpression expression) { }
示例14: Visit
public override void Visit(DbSkipExpression e)
{
Check.NotNull(e, "e");
Begin(e);
Dump(e.Input, "Input");
Dump(e.SortOrder);
Dump(e.Count, "Count");
End(e);
}
示例15: Visit
public override DbExpression Visit(DbSkipExpression expression)
{
DbExpression found = Find(expression.Input.Expression);
if (!object.ReferenceEquals(found, expression.Input.Expression))
{
return found.BindAs(expression.Input.VariableName).Skip(expression.SortOrder, expression.Count);
}
else
{
return expression;
}
}