本文整理汇总了C#中System.Linq.Expressions.Expression.GetRootObject方法的典型用法代码示例。如果您正苦于以下问题:C# Expression.GetRootObject方法的具体用法?C# Expression.GetRootObject怎么用?C# Expression.GetRootObject使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Linq.Expressions.Expression
的用法示例。
在下文中一共展示了Expression.GetRootObject方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ConvertToSql
public override SqlInfo[] ConvertToSql(Expression expression, int level, ConvertFlags flags)
{
if (level == 0)
{
switch (flags)
{
case ConvertFlags.Field :
case ConvertFlags.Key :
case ConvertFlags.All :
{
var root = expression.GetRootObject();
if (root.NodeType == ExpressionType.Parameter)
{
var ctx = Parser.GetContext(this, root);
if (ctx != null)
{
if (ctx != this)
return ctx.ConvertToSql(expression, 0, flags);
return root == expression ?
Sequence.ConvertToSql(null, 0, flags) :
Sequence.ConvertToSql(expression, level + 1, flags);
}
}
break;
}
}
throw new NotImplementedException();
}
throw new InvalidOperationException();
//return Array<ISqlExpression>.Empty;
}
示例2: ConvertToSql
public override SqlInfo[] ConvertToSql(Expression expression, int level, ConvertFlags flags)
{
if (level == 0)
{
switch (flags)
{
case ConvertFlags.Field :
case ConvertFlags.Key :
case ConvertFlags.All :
{
var root = expression.GetRootObject();
if (root.NodeType == ExpressionType.Parameter)
{
var ctx = Builder.GetContext(this, root);
if (ctx != null)
{
if (ctx != this)
return ctx.ConvertToSql(expression, 0, flags);
return root == expression ?
Sequence.ConvertToSql(null, 0, flags) :
Sequence.ConvertToSql(expression, level + 1, flags);
}
}
break;
}
}
throw new LinqException("'{0}' cannot be converted to SQL.", expression);
}
throw new InvalidOperationException();
}
示例3: GetContext
public IParseContext GetContext(IParseContext current, Expression expression)
{
var root = expression.GetRootObject();
for (var ctx = current; current != null; current = current.Parent)
if (ctx.IsExpression(root, 0, RequestFor.Root))
return ctx;
return null;
}