本文整理汇总了C#中System.Linq.Expressions.InvocationExpression.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# InvocationExpression.ToString方法的具体用法?C# InvocationExpression.ToString怎么用?C# InvocationExpression.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Linq.Expressions.InvocationExpression
的用法示例。
在下文中一共展示了InvocationExpression.ToString方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: VisitInvocation
/// <summary>
/// We are doing an inline call to a lambda expression.
/// </summary>
/// <param name="expression"></param>
/// <returns></returns>
protected override Expression VisitInvocation(InvocationExpression expression)
{
///
/// Declare all the parameters for lookup.
///
if (!(expression.Expression is LambdaExpression))
throw new NotImplementedException("Do not know how to invoke a non-lambda call like '" + expression.ToString() + "'");
var lambda = expression.Expression as LambdaExpression;
var paramArgs = lambda.Parameters.Zip(expression.Arguments, (p, a) => Tuple.Create(p, a));
var paramDefineToPopers = from pair in paramArgs
select CodeContext.Add(pair.Item1.Name, pair.Item2);
var allParamDefineToPopers = paramDefineToPopers.ToArray();
///
/// Do the work. We parse the body of the lambda expression. The references to the parameters should be automatically
/// dealt with.
///
var result = lambda.Body.Resolve(GeneratedCode, CodeContext, MEFContainer);
///
/// Now, pop everything off!
///
foreach (var param in allParamDefineToPopers)
{
param.Pop();
}
///
/// Done!
///
return result;
}
示例2: VisitInvocation
internal override Expression VisitInvocation(InvocationExpression iv)
{
if (ClientType.CheckElementTypeIsEntity(iv.Expression.Type) || IsCollectionProducingExpression(iv.Expression)
|| iv.Arguments.Any(a => ClientType.CheckElementTypeIsEntity(a.Type) || IsCollectionProducingExpression(a)))
{
throw new NotSupportedException(Strings.ALinq_ExpressionNotSupportedInProjection(this.type, iv.ToString()));
}
return base.VisitInvocation(iv);
}
示例3: VisitInvocation
internal override Expression VisitInvocation(InvocationExpression iv)
{
if (CommonUtil.IsClientType(iv.Expression.Type)
|| iv.Arguments.Any(a => CommonUtil.IsClientType(a.Type)))
{
throw new NotSupportedException(string.Format(CultureInfo.CurrentCulture, SR.ALinqExpressionNotSupportedInProjection, this.type, iv.ToString()));
}
return base.VisitInvocation(iv);
}
示例4: VisitInvocation
internal override Expression VisitInvocation(InvocationExpression iv)
{
if ((ClientTypeUtil.TypeOrElementTypeIsEntity(iv.Expression.Type) || ProjectionAnalyzer.IsCollectionProducingExpression(iv.Expression)) || iv.Arguments.Any<Expression>(delegate (Expression a) {
if (!ClientTypeUtil.TypeOrElementTypeIsEntity(a.Type))
{
return ProjectionAnalyzer.IsCollectionProducingExpression(a);
}
return true;
}))
{
throw new NotSupportedException(System.Data.Services.Client.Strings.ALinq_ExpressionNotSupportedInProjection(this.type, iv.ToString()));
}
return base.VisitInvocation(iv);
}