Exemplo n.º 1
0
        public override SqlInfo[] ConvertToSql(Expression?expression, int level, ConvertFlags flags)
        {
            if (expression == null)
            {
                throw new ArgumentNullException(nameof(expression));
            }

            if (expression.GetLevelExpression(Builder.MappingSchema, level) is ContextRefExpression refExpression && refExpression.BuildContext == this)
            {
                ++level;
            }

            return(SubQuery
                   .ConvertToIndex(expression, level, flags)
                   .Select(info =>
            {
                var expr = (info.Sql is SqlColumn column) ? column.Expression : info.Sql;
                var field = RegisterSourceField(expr, expr, info.Index, info.MemberChain.LastOrDefault());

                return new SqlInfo(info.MemberChain)
                {
                    Sql = field
                };
            })
                   .ToArray());
        }
Exemplo n.º 2
0
 public override SqlInfo[] ConvertToSql(Expression expression, int level, ConvertFlags flags)
 {
     return(SubQuery
            .ConvertToIndex(expression, level, flags)
            .Select(idx => new SqlInfo((idx.Members))
     {
         Sql = SubQuery.SelectQuery.Select.Columns[idx.Index]
     })
            .ToArray());
 }
Exemplo n.º 3
0
        public override SqlInfo[] ConvertToSql(Expression?expression, int level, ConvertFlags flags)
        {
            expression = SequenceHelper.CorrectExpression(expression, this, Context);

            var indexes = SubQuery
                          .ConvertToIndex(expression, level, flags)
                          .ToArray();

            var result = indexes
                         .Select(idx => new SqlInfo(idx.MemberChain, idx.Index < 0 ? idx.Sql : SubQuery.SelectQuery.Select.Columns[idx.Index], idx.Index))
                         .ToArray();

            return(result);
        }
Exemplo n.º 4
0
        public override SqlInfo[] ConvertToSql(Expression?expression, int level, ConvertFlags flags)
        {
            expression = SequenceHelper.CorrectExpression(expression, this, SubQuery);

            return(SubQuery
                   .ConvertToIndex(expression, level, flags)
                   .Select(info =>
            {
                var expr = (info.Sql is SqlColumn column) ? column.Expression : info.Sql;
                var field = RegisterSourceField(expr, expr, info.Index, info.MemberChain.LastOrDefault());

                return new SqlInfo(info.MemberChain, field);
            })
                   .ToArray());
        }