本文整理汇总了C#中System.Linq.Expressions.MemberAssignment类的典型用法代码示例。如果您正苦于以下问题:C# MemberAssignment类的具体用法?C# MemberAssignment怎么用?C# MemberAssignment使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MemberAssignment类属于System.Linq.Expressions命名空间,在下文中一共展示了MemberAssignment类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: VisitMemberAssignment
protected override MemberAssignment VisitMemberAssignment(MemberAssignment node)
{
string propertyName = node.Member.Name;
string fieldName = DbMetaDataManager.GetFieldName(node.Member.DeclaringType, propertyName);
if (node.Expression.NodeType == ExpressionType.Call)
{
VisitMethodCall((MethodCallExpression)node.Expression,fieldName);
}
else if (node.Expression.NodeType == ExpressionType.Convert)
{
var ue = node.Expression as UnaryExpression;
var call = ue.Operand as MethodCallExpression;
if (call != null)
this.VisitMethodCall(call, fieldName);
else
this.MyVisitMember(ue.Operand as MemberExpression,fieldName);
}
else
{
parameters.Add(fieldName, new Parameter(ParamPrefix + fieldName, null));
var constant = node.Expression as ConstantExpression;
if (constant != null)
VisitConstant(constant, fieldName);
else
{
LambdaExpression lambda = Expression.Lambda(node.Expression);
var fn = lambda.Compile();
VisitConstant(Expression.Constant(fn.DynamicInvoke(null), node.Expression.Type), fieldName);
}
}
return node;
}
示例2: UpdateMemberAssignment
protected MemberAssignment UpdateMemberAssignment(MemberAssignment assignment, MemberInfo member, Expression expression)
{
if (expression != assignment.Expression || member != assignment.Member) {
return Expression.Bind(member, expression);
}
return assignment;
}
示例3: VisitMemberAssignment
protected override MemberAssignment VisitMemberAssignment(MemberAssignment assignment)
{
var property = assignment.Member as PropertyInfo;
if (property == null)
{
throw new NotSupportedException(
String.Format("{0} is not a property.", assignment.Member));
}
IPropertyUpdate update;
var expr = PartialEval(assignment.Expression);
switch (expr.NodeType)
{
case ExpressionType.Constant:
update = ConstantUpdate.Create(property, (ConstantExpression)expr);
break;
case ExpressionType.Add:
case ExpressionType.Subtract:
update = BinaryUpdate.Create(property, (BinaryExpression)expr);
break;
case ExpressionType.Call:
update = MethodCallUpdate.Create(property, (MethodCallExpression)expr);
break;
default:
throw new NotSupportedException();
}
this.m_updates.Add(update);
return assignment;
}
示例4: VisitMemberAssignment
protected override MemberAssignment VisitMemberAssignment(MemberAssignment assignment)
{
this.output.Append(assignment.Member.Name).Append(" = ");
this.Visit(assignment.Expression);
return assignment;
}
示例5: VisitMemberAssignment
protected override MemberAssignment VisitMemberAssignment(MemberAssignment assignment)
{
var saveMember = this.currentMember;
this.currentMember = assignment.Member;
Expression e = this.Visit(assignment.Expression);
this.currentMember = saveMember;
return this.UpdateMemberAssignment(assignment, assignment.Member, e);
}
示例6: VisitMemberAssignment
protected override MemberAssignment VisitMemberAssignment(MemberAssignment node)
{
var constantValue = node.Expression as ConstantExpression;
if (constantValue != null)
{
_updateBuilder.Set(String.Join(".", _assigments.Reverse().ToArray()), BsonValue.Create(constantValue.Value));
}
else
{
return base.VisitMemberAssignment(node);
}
return node;
}
示例7: VisitMemberAssignment
/// <summary>
/// Visits a MemberAssignment.
/// </summary>
/// <param name="node">The MemberAssignment.</param>
/// <returns>The MemberAssignment (possibly modified).</returns>
protected virtual MemberAssignment VisitMemberAssignment(MemberAssignment node)
{
Expression e = Visit(node.Expression);
return UpdateMemberAssignment(node, node.Member, e);
}
示例8: MemberAssignmentNode
public MemberAssignmentNode(INodeFactory factory, MemberAssignment memberAssignment)
: base(factory, memberAssignment.BindingType, memberAssignment.Member)
{
this.Expression = this.Factory.Create(memberAssignment.Expression);
}
示例9: VisitMemberAssignment
protected virtual MemberAssignment VisitMemberAssignment(MemberAssignment assignment)
{
System.Linq.Expressions.Expression e = Visit(assignment.Expression);
if(e != assignment.Expression)
{
return System.Linq.Expressions.Expression.Bind(assignment.Member, e);
}
return assignment;
}
示例10: VisitMemberAssignment
protected override MemberAssignment VisitMemberAssignment(MemberAssignment assignment)
{
this.Write(assignment.Member.Name);
this.Write(" = ");
this.Visit(assignment.Expression);
return assignment;
}
示例11: VisitMemberAssignment
/// <summary>
/// Visit a member assignment expression.
/// </summary>
/// <param name="assignmentExp"></param>
/// <returns></returns>
protected virtual MemberAssignment VisitMemberAssignment(MemberAssignment assignmentExp)
{
Expression e = Visit(assignmentExp.Expression);
return e != assignmentExp.Expression ? Expression.Bind(assignmentExp.Member, e) : assignmentExp;
}
示例12: VisitMemberAssignment
/// <summary>
/// Visit a member assignment expression.
/// </summary>
/// <param name="assignmentExp"></param>
/// <returns></returns>
protected virtual MemberAssignment VisitMemberAssignment(MemberAssignment assignmentExp)
{
Expression e = Visit(assignmentExp.Expression);
if (e != assignmentExp.Expression)
{
return Expression.Bind(assignmentExp.Member, e);
}
return assignmentExp;
}
示例13: CompareMemberAssignment
protected virtual bool CompareMemberAssignment(MemberAssignment a, MemberAssignment b)
{
return a.Member == b.Member
&& this.Compare(a.Expression, b.Expression);
}
示例14: VisitMemberAssignment
protected override MemberBinding VisitMemberAssignment(MemberAssignment memberAssigment)
{
CheckAndVisitMemberAssignment (memberAssigment.Member, memberAssigment.Expression);
return memberAssigment;
}
示例15: VisitMemberAssignment
protected virtual MemberAssignment VisitMemberAssignment(MemberAssignment assignment, Stack<string> stack, Stack<IElasticPropertyAttribute> properties)
{
Expression e = this.Visit(assignment.Expression, stack, properties);
if (e != assignment.Expression)
{
return Expression.Bind(assignment.Member, e);
}
return assignment;
}