Exemplo n.º 1
0
        protected override void AddInFilterCondition <T, TMember>(
            Expression <Func <T, TMember> > selector,
            TMember[] values,
            string alias = null,
            LogicalOperator locigalOperator = LogicalOperator.NotSet)
        {
            if (values == null || !values.Any())
            {
                return;
            }
            var conditions       = currentFilterGroup.Conditions;
            var filterCondition1 = new FilterCondition();

            filterCondition1.Alias           = alias;
            filterCondition1.EntityType      = typeof(T);
            filterCondition1.LocigalOperator = locigalOperator;
            filterCondition1.Left            = GetMemberColumnName(ConvertExpression(selector));
            filterCondition1.Operator        = "IN";
            filterCondition1.Right           = "(" + string.Join(", ", values.Select(v => FormatValue(v))) + ")";
            var filterCondition2 = filterCondition1;

            conditions.Add(filterCondition2);
        }
Exemplo n.º 2
0
        protected override void AddFilterCondition <T>(
            Expression <Func <T, bool> > selector,
            string alias = null,
            LogicalOperator logicalOperator = LogicalOperator.NotSet)
        {
            var conditions = currentFilterGroup.Conditions;
            var lambdaTree =
                AtkExpressionWriterSql <T> .AtkWhereWriteToStringWithParameters(selector, AtkExpSqlType.AtkWhere, "[",
                                                                                "]");

            var filterCondition1 = new FilterCondition
            {
                Alias                = alias,
                EntityType           = typeof(T),
                Left                 = "_LambdaTree_",
                LocigalOperator      = logicalOperator,
                LambdaTree           = lambdaTree?.Sql,
                ParameterDefinitions = lambdaTree?.Parameters,
                ExpressionOperator   = lambdaTree?.Operator
            };

            conditions.Add(filterCondition1);
        }