示例#1
0
        public void ResolveWhere <T>(bool and, bool pre, Expression <Func <T, bool> > expression)
        {
            if (expression == null)
            {
                return;
            }
            builder.PartType = SqlPartType.Where;
            if (pre)
            {
                builder.BeginExpression();
            }
            else
            {
                if (and)
                {
                    builder.And();
                }
                else
                {
                    builder.Or();
                }
            }
            var node = this.Visit((dynamic)expression.Body);

            builder.BuildWhere(node);
        }
        public void ResolveWhereIn <T, TKey>(SqlInType type, Expression <Func <T, TKey> > expression, IEnumerable <object> values, bool andOr)
        {
            builder.TableType = typeof(T);
            builder.PartType  = SqlPartType.Where;
            var member = ExpressionHelper.GetMemberExpression(expression.Body);

            if (member != null)
            {
                if (andOr)
                {
                    builder.And();
                }
                else
                {
                    builder.Or();
                }
                InNode node = new InNode(type, new MemberNode(member), values);
                builder.BuildWhere(node);
            }
        }