本文整理匯總了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;
}