示例#1
0
        private void ProcessNode(ExpressionType nodeType, ConstantExpression cNode, MemberExpression mNode)
        {
            var memberName = mNode.Member.GetMappingName();

            this._conditions.Push($"{memberName} {MontageSqlHelper.GetSqlOperate(nodeType)} {MontageSqlHelper.SqlPrifix}{memberName}");

            var value = cNode.Value.ToString();

            this._parameters.Add(new MySqlParameter($"{MontageSqlHelper.SqlPrifix}{memberName}", value));
        }
示例#2
0
        protected override Expression VisitBinary(BinaryExpression node)
        {
            if (node.Left.NodeType == ExpressionType.MemberAccess && node.Right.NodeType == ExpressionType.Constant)
            {
                this.ProcessNode(node.NodeType, (ConstantExpression)node.Right, (MemberExpression)node.Left);
                return(node);
            }
            if (node.Left.NodeType == ExpressionType.Constant && node.Right.NodeType == ExpressionType.MemberAccess)
            {
                this.ProcessNode(node.NodeType, (ConstantExpression)node.Left, (MemberExpression)node.Right);
                return(node);
            }
            this.Visit(node.Left);
            this._conditions.Push(MontageSqlHelper.GetSqlOperate(node.NodeType));
            this.Visit(node.Right);

            return(node);
        }