当前位置: 首页>>代码示例>>C#>>正文


C# Expressions.MemberAssignment类代码示例

本文整理汇总了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;
        }
开发者ID:yaozd,项目名称:YOYOFx,代码行数:35,代码来源:FieldsFormater.cs

示例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;
 }
开发者ID:kpfaulkner,项目名称:Linq-To-Search,代码行数:7,代码来源:ExpressionVisitor.cs

示例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;
        }
开发者ID:jefth,项目名称:EasyMongo,代码行数:31,代码来源:UpdateCollector.cs

示例4: VisitMemberAssignment

		protected override MemberAssignment VisitMemberAssignment(MemberAssignment assignment)
		{
			this.output.Append(assignment.Member.Name).Append(" = ");
			this.Visit(assignment.Expression);

			return assignment;
		}
开发者ID:tumtumtum,项目名称:Shaolinq,代码行数:7,代码来源:ProjectorFormatter.cs

示例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);
 }
开发者ID:RukaiYu,项目名称:EnterpriseDevelopmentFx,代码行数:8,代码来源:ClientJoinedProjectionRewriter.cs

示例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;
        }
开发者ID:kolupaev,项目名称:mongo-csharp-driver,代码行数:14,代码来源:UpdateExpressionVisitor.cs

示例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);
 }
开发者ID:sprucemedia,项目名称:oinq,代码行数:10,代码来源:ExpressionVisitor.cs

示例8: MemberAssignmentNode

 public MemberAssignmentNode(INodeFactory factory, MemberAssignment memberAssignment)
     : base(factory, memberAssignment.BindingType, memberAssignment.Member)
 {
     this.Expression = this.Factory.Create(memberAssignment.Expression);
 }
开发者ID:jonparker,项目名称:Serialize.Linq,代码行数:5,代码来源:MemberAssignmentNode.cs

示例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;
 }
开发者ID:NatashaSchutte,项目名称:Warewolf-ESB,代码行数:9,代码来源:ExpressionVisitor.cs

示例10: VisitMemberAssignment

 protected override MemberAssignment VisitMemberAssignment(MemberAssignment assignment)
 {
     this.Write(assignment.Member.Name);
     this.Write(" = ");
     this.Visit(assignment.Expression);
     return assignment;
 }
开发者ID:PaybackMan,项目名称:Cinder,代码行数:7,代码来源:ExpressionWriter.cs

示例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;
        }
开发者ID:jd-pantheon,项目名称:Titan-Framework-v2,代码行数:11,代码来源:ExpressionVisitor.cs

示例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;
        }
开发者ID:RebelCMS,项目名称:rebelcmsxu5,代码行数:16,代码来源:ExpressionVisitor.cs

示例13: CompareMemberAssignment

 protected virtual bool CompareMemberAssignment(MemberAssignment a, MemberAssignment b)
 {
     return a.Member == b.Member
         && this.Compare(a.Expression, b.Expression);
 }
开发者ID:hamdouchi97,项目名称:Stump.ORM,代码行数:5,代码来源:ExpressionComparer.cs

示例14: VisitMemberAssignment

 protected override MemberBinding VisitMemberAssignment(MemberAssignment memberAssigment)
 {
     CheckAndVisitMemberAssignment (memberAssigment.Member, memberAssigment.Expression);
       return memberAssigment;
 }
开发者ID:nicocrm,项目名称:DotNetSDataClient,代码行数:5,代码来源:AccessorFindingExpressionTreeVisitor.cs

示例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;
 }
开发者ID:herqueles3,项目名称:elasticsearch-net,代码行数:9,代码来源:ExpressionVisitor.cs


注:本文中的System.Linq.Expressions.MemberAssignment类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。