本文整理汇总了C#中IExpressionNode.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# IExpressionNode.ToString方法的具体用法?C# IExpressionNode.ToString怎么用?C# IExpressionNode.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IExpressionNode
的用法示例。
在下文中一共展示了IExpressionNode.ToString方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetConstantValue
private object GetConstantValue(IExpressionNode argument)
{
var node = argument as IConstantExpressionNode;
if (node != null)
return node.Value;
var name = argument.TryGetMemberName(false, false);
if (name == null)
throw BindingExceptionManager.InvalidExpressionParser(argument.ToString(), Tokenizer, Expression);
return name;
}
示例2: ValidateLambdaParameter
private void ValidateLambdaParameter(IExpressionNode node)
{
var expressionNode = node as IMemberExpressionNode;
if (expressionNode == null || expressionNode.Target != null)
throw BindingExceptionManager.InvalidExpressionParser(node.ToString(), Tokenizer, Expression);
}
示例3: GetBindingValueSetterMain
private Action<IDataContext> GetBindingValueSetterMain(IExpressionNode node, Action<IDataContext, object> setSimpleValue,
Action<IDataContext, Func<IDataContext, object>> setComplexValue, bool useBindingForMember)
{
var constantNode = node as IConstantExpressionNode;
if (constantNode != null)
{
object value = constantNode.Value;
return context => setSimpleValue(context, value);
}
var nodes = new List<IExpressionNode>();
var members = new List<string>();
string memberName = node.TryGetMemberName(true, true, nodes, members);
var resourceExpression = nodes[0] as ResourceExpressionNode;
if (memberName != null)
{
if (resourceExpression != null)
{
if (resourceExpression.Dynamic)
return context => setComplexValue(context, d => GetResourceObject(memberName, d));
return context => setSimpleValue(context, GetResourceObject(memberName, context));
}
if (!useBindingForMember)
return context => setSimpleValue(context, memberName);
node = RelativeSourceExpressionNode.CreateBindingContextSource(memberName);
}
var methodCall = nodes[0] as IMethodCallExpressionNode;
if (methodCall == null)
{
var relativeSrc = node as IRelativeSourceExpressionNode;
if (relativeSrc == null)
throw BindingExceptionManager.UnknownIdentifierParser(node.ToString(), Tokenizer, Expression);
return context =>
{
var src = BindingExtensions.CreateBindingSource(relativeSrc, context.GetData(BindingBuilderConstants.Target, true), null);
setComplexValue(context, d => src.GetCurrentValue());
};
}
resourceExpression = methodCall.Target as ResourceExpressionNode;
if (resourceExpression == null || methodCall.Arguments.Any(expressionNode => !(expressionNode is IConstantExpressionNode)))
throw BindingExceptionManager.UnknownIdentifierParser(node.ToString(), Tokenizer, Expression);
var method = methodCall.Method;
var args = methodCall.Arguments.ToArrayEx(ex => ((IConstantExpressionNode)ex).Value);
var memberPath = members.Count == 0 ? null : BindingExtensions.MergePath(members);
if (resourceExpression.Dynamic)
return context => setComplexValue(context, d => InvokeMethod(d, method, args, memberPath));
return context => setSimpleValue(context, InvokeMethod(context, method, args, memberPath));
}